
bin/kernel:     file format elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:
.text
.globl kern_entry
kern_entry:
    # reload temperate gdt (second time) to remap all physical memory
    # virtual_addr 0~4G=linear_addr&physical_addr -KERNBASE~4G-KERNBASE 
    lgdt REALLOC(__gdtdesc)
c0100000:	0f 01 15 18 40 12 00 	lgdtl  0x124018
    movl $KERNEL_DS, %eax
c0100007:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c010000c:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c010000e:	8e c0                	mov    %eax,%es
    movw %ax, %ss
c0100010:	8e d0                	mov    %eax,%ss

    ljmp $KERNEL_CS, $relocated
c0100012:	ea 19 00 10 c0 08 00 	ljmp   $0x8,$0xc0100019

c0100019 <relocated>:

relocated:

    # set ebp, esp
    movl $0x0, %ebp
c0100019:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010001e:	bc 00 40 12 c0       	mov    $0xc0124000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c0100023:	e8 02 00 00 00       	call   c010002a <kern_init>

c0100028 <spin>:

# should never get here
spin:
    jmp spin
c0100028:	eb fe                	jmp    c0100028 <spin>

c010002a <kern_init>:
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);

int
kern_init(void) {
c010002a:	55                   	push   %ebp
c010002b:	89 e5                	mov    %esp,%ebp
c010002d:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100030:	ba 18 7c 12 c0       	mov    $0xc0127c18,%edx
c0100035:	b8 90 4a 12 c0       	mov    $0xc0124a90,%eax
c010003a:	29 c2                	sub    %eax,%edx
c010003c:	89 d0                	mov    %edx,%eax
c010003e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100042:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100049:	00 
c010004a:	c7 04 24 90 4a 12 c0 	movl   $0xc0124a90,(%esp)
c0100051:	e8 b7 99 00 00       	call   c0109a0d <memset>

    cons_init();                // init the console
c0100056:	e8 ce 14 00 00       	call   c0101529 <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c010005b:	c7 45 f4 a0 9b 10 c0 	movl   $0xc0109ba0,-0xc(%ebp)
    cprintf("%s\n\n", message);
c0100062:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100065:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100069:	c7 04 24 bc 9b 10 c0 	movl   $0xc0109bbc,(%esp)
c0100070:	e8 de 02 00 00       	call   c0100353 <cprintf>

    print_kerninfo();
c0100075:	e8 0d 08 00 00       	call   c0100887 <print_kerninfo>

    grade_backtrace();
c010007a:	e8 9d 00 00 00       	call   c010011c <grade_backtrace>

    pmm_init();                 // init physical memory management
c010007f:	e8 24 52 00 00       	call   c01052a8 <pmm_init>

    pic_init();                 // init interrupt controller
c0100084:	e8 7e 1e 00 00       	call   c0101f07 <pic_init>
    idt_init();                 // init interrupt descriptor table
c0100089:	e8 d0 1f 00 00       	call   c010205e <idt_init>

    vmm_init();                 // init virtual memory management
c010008e:	e8 ad 78 00 00       	call   c0107940 <vmm_init>
    proc_init();                // init process table
c0100093:	e8 6b 8b 00 00       	call   c0108c03 <proc_init>
    
    ide_init();                 // init ide devices
c0100098:	e8 bd 15 00 00       	call   c010165a <ide_init>
    swap_init();                // init swap
c010009d:	e8 8d 64 00 00       	call   c010652f <swap_init>

    clock_init();               // init clock interrupt
c01000a2:	e8 38 0c 00 00       	call   c0100cdf <clock_init>
    intr_enable();              // enable irq interrupt
c01000a7:	e8 c9 1d 00 00       	call   c0101e75 <intr_enable>

    //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test()
    // user/kernel mode switch test
    //lab1_switch_test();
    
    cpu_idle();                 // run idle process
c01000ac:	e8 11 8d 00 00       	call   c0108dc2 <cpu_idle>

c01000b1 <grade_backtrace2>:
}

void __attribute__((noinline))
grade_backtrace2(int arg0, int arg1, int arg2, int arg3) {
c01000b1:	55                   	push   %ebp
c01000b2:	89 e5                	mov    %esp,%ebp
c01000b4:	83 ec 18             	sub    $0x18,%esp
    mon_backtrace(0, NULL, NULL);
c01000b7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01000be:	00 
c01000bf:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01000c6:	00 
c01000c7:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01000ce:	e8 3e 0b 00 00       	call   c0100c11 <mon_backtrace>
}
c01000d3:	c9                   	leave  
c01000d4:	c3                   	ret    

c01000d5 <grade_backtrace1>:

void __attribute__((noinline))
grade_backtrace1(int arg0, int arg1) {
c01000d5:	55                   	push   %ebp
c01000d6:	89 e5                	mov    %esp,%ebp
c01000d8:	53                   	push   %ebx
c01000d9:	83 ec 14             	sub    $0x14,%esp
    grade_backtrace2(arg0, (int)&arg0, arg1, (int)&arg1);
c01000dc:	8d 5d 0c             	lea    0xc(%ebp),%ebx
c01000df:	8b 4d 0c             	mov    0xc(%ebp),%ecx
c01000e2:	8d 55 08             	lea    0x8(%ebp),%edx
c01000e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01000e8:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01000ec:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01000f0:	89 54 24 04          	mov    %edx,0x4(%esp)
c01000f4:	89 04 24             	mov    %eax,(%esp)
c01000f7:	e8 b5 ff ff ff       	call   c01000b1 <grade_backtrace2>
}
c01000fc:	83 c4 14             	add    $0x14,%esp
c01000ff:	5b                   	pop    %ebx
c0100100:	5d                   	pop    %ebp
c0100101:	c3                   	ret    

c0100102 <grade_backtrace0>:

void __attribute__((noinline))
grade_backtrace0(int arg0, int arg1, int arg2) {
c0100102:	55                   	push   %ebp
c0100103:	89 e5                	mov    %esp,%ebp
c0100105:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace1(arg0, arg2);
c0100108:	8b 45 10             	mov    0x10(%ebp),%eax
c010010b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010010f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100112:	89 04 24             	mov    %eax,(%esp)
c0100115:	e8 bb ff ff ff       	call   c01000d5 <grade_backtrace1>
}
c010011a:	c9                   	leave  
c010011b:	c3                   	ret    

c010011c <grade_backtrace>:

void
grade_backtrace(void) {
c010011c:	55                   	push   %ebp
c010011d:	89 e5                	mov    %esp,%ebp
c010011f:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace0(0, (int)kern_init, 0xffff0000);
c0100122:	b8 2a 00 10 c0       	mov    $0xc010002a,%eax
c0100127:	c7 44 24 08 00 00 ff 	movl   $0xffff0000,0x8(%esp)
c010012e:	ff 
c010012f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100133:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c010013a:	e8 c3 ff ff ff       	call   c0100102 <grade_backtrace0>
}
c010013f:	c9                   	leave  
c0100140:	c3                   	ret    

c0100141 <lab1_print_cur_status>:

static void
lab1_print_cur_status(void) {
c0100141:	55                   	push   %ebp
c0100142:	89 e5                	mov    %esp,%ebp
c0100144:	83 ec 28             	sub    $0x28,%esp
    static int round = 0;
    uint16_t reg1, reg2, reg3, reg4;
    asm volatile (
c0100147:	8c 4d f6             	mov    %cs,-0xa(%ebp)
c010014a:	8c 5d f4             	mov    %ds,-0xc(%ebp)
c010014d:	8c 45 f2             	mov    %es,-0xe(%ebp)
c0100150:	8c 55 f0             	mov    %ss,-0x10(%ebp)
            "mov %%cs, %0;"
            "mov %%ds, %1;"
            "mov %%es, %2;"
            "mov %%ss, %3;"
            : "=m"(reg1), "=m"(reg2), "=m"(reg3), "=m"(reg4));
    cprintf("%d: @ring %d\n", round, reg1 & 3);
c0100153:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100157:	0f b7 c0             	movzwl %ax,%eax
c010015a:	83 e0 03             	and    $0x3,%eax
c010015d:	89 c2                	mov    %eax,%edx
c010015f:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c0100164:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100168:	89 44 24 04          	mov    %eax,0x4(%esp)
c010016c:	c7 04 24 c1 9b 10 c0 	movl   $0xc0109bc1,(%esp)
c0100173:	e8 db 01 00 00       	call   c0100353 <cprintf>
    cprintf("%d:  cs = %x\n", round, reg1);
c0100178:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010017c:	0f b7 d0             	movzwl %ax,%edx
c010017f:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c0100184:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100188:	89 44 24 04          	mov    %eax,0x4(%esp)
c010018c:	c7 04 24 cf 9b 10 c0 	movl   $0xc0109bcf,(%esp)
c0100193:	e8 bb 01 00 00       	call   c0100353 <cprintf>
    cprintf("%d:  ds = %x\n", round, reg2);
c0100198:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c010019c:	0f b7 d0             	movzwl %ax,%edx
c010019f:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c01001a4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001a8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ac:	c7 04 24 dd 9b 10 c0 	movl   $0xc0109bdd,(%esp)
c01001b3:	e8 9b 01 00 00       	call   c0100353 <cprintf>
    cprintf("%d:  es = %x\n", round, reg3);
c01001b8:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01001bc:	0f b7 d0             	movzwl %ax,%edx
c01001bf:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c01001c4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001c8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001cc:	c7 04 24 eb 9b 10 c0 	movl   $0xc0109beb,(%esp)
c01001d3:	e8 7b 01 00 00       	call   c0100353 <cprintf>
    cprintf("%d:  ss = %x\n", round, reg4);
c01001d8:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c01001dc:	0f b7 d0             	movzwl %ax,%edx
c01001df:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c01001e4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001e8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ec:	c7 04 24 f9 9b 10 c0 	movl   $0xc0109bf9,(%esp)
c01001f3:	e8 5b 01 00 00       	call   c0100353 <cprintf>
    round ++;
c01001f8:	a1 a0 4a 12 c0       	mov    0xc0124aa0,%eax
c01001fd:	83 c0 01             	add    $0x1,%eax
c0100200:	a3 a0 4a 12 c0       	mov    %eax,0xc0124aa0
}
c0100205:	c9                   	leave  
c0100206:	c3                   	ret    

c0100207 <lab1_switch_to_user>:

static void
lab1_switch_to_user(void) {
c0100207:	55                   	push   %ebp
c0100208:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 : TODO
}
c010020a:	5d                   	pop    %ebp
c010020b:	c3                   	ret    

c010020c <lab1_switch_to_kernel>:

static void
lab1_switch_to_kernel(void) {
c010020c:	55                   	push   %ebp
c010020d:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 :  TODO
}
c010020f:	5d                   	pop    %ebp
c0100210:	c3                   	ret    

c0100211 <lab1_switch_test>:

static void
lab1_switch_test(void) {
c0100211:	55                   	push   %ebp
c0100212:	89 e5                	mov    %esp,%ebp
c0100214:	83 ec 18             	sub    $0x18,%esp
    lab1_print_cur_status();
c0100217:	e8 25 ff ff ff       	call   c0100141 <lab1_print_cur_status>
    cprintf("+++ switch to  user  mode +++\n");
c010021c:	c7 04 24 08 9c 10 c0 	movl   $0xc0109c08,(%esp)
c0100223:	e8 2b 01 00 00       	call   c0100353 <cprintf>
    lab1_switch_to_user();
c0100228:	e8 da ff ff ff       	call   c0100207 <lab1_switch_to_user>
    lab1_print_cur_status();
c010022d:	e8 0f ff ff ff       	call   c0100141 <lab1_print_cur_status>
    cprintf("+++ switch to kernel mode +++\n");
c0100232:	c7 04 24 28 9c 10 c0 	movl   $0xc0109c28,(%esp)
c0100239:	e8 15 01 00 00       	call   c0100353 <cprintf>
    lab1_switch_to_kernel();
c010023e:	e8 c9 ff ff ff       	call   c010020c <lab1_switch_to_kernel>
    lab1_print_cur_status();
c0100243:	e8 f9 fe ff ff       	call   c0100141 <lab1_print_cur_status>
}
c0100248:	c9                   	leave  
c0100249:	c3                   	ret    

c010024a <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c010024a:	55                   	push   %ebp
c010024b:	89 e5                	mov    %esp,%ebp
c010024d:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c0100250:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100254:	74 13                	je     c0100269 <readline+0x1f>
        cprintf("%s", prompt);
c0100256:	8b 45 08             	mov    0x8(%ebp),%eax
c0100259:	89 44 24 04          	mov    %eax,0x4(%esp)
c010025d:	c7 04 24 47 9c 10 c0 	movl   $0xc0109c47,(%esp)
c0100264:	e8 ea 00 00 00       	call   c0100353 <cprintf>
    }
    int i = 0, c;
c0100269:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        c = getchar();
c0100270:	e8 66 01 00 00       	call   c01003db <getchar>
c0100275:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (c < 0) {
c0100278:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010027c:	79 07                	jns    c0100285 <readline+0x3b>
            return NULL;
c010027e:	b8 00 00 00 00       	mov    $0x0,%eax
c0100283:	eb 79                	jmp    c01002fe <readline+0xb4>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c0100285:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
c0100289:	7e 28                	jle    c01002b3 <readline+0x69>
c010028b:	81 7d f4 fe 03 00 00 	cmpl   $0x3fe,-0xc(%ebp)
c0100292:	7f 1f                	jg     c01002b3 <readline+0x69>
            cputchar(c);
c0100294:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100297:	89 04 24             	mov    %eax,(%esp)
c010029a:	e8 da 00 00 00       	call   c0100379 <cputchar>
            buf[i ++] = c;
c010029f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01002a2:	8d 50 01             	lea    0x1(%eax),%edx
c01002a5:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01002a8:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01002ab:	88 90 c0 4a 12 c0    	mov    %dl,-0x3fedb540(%eax)
c01002b1:	eb 46                	jmp    c01002f9 <readline+0xaf>
        }
        else if (c == '\b' && i > 0) {
c01002b3:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
c01002b7:	75 17                	jne    c01002d0 <readline+0x86>
c01002b9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01002bd:	7e 11                	jle    c01002d0 <readline+0x86>
            cputchar(c);
c01002bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002c2:	89 04 24             	mov    %eax,(%esp)
c01002c5:	e8 af 00 00 00       	call   c0100379 <cputchar>
            i --;
c01002ca:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c01002ce:	eb 29                	jmp    c01002f9 <readline+0xaf>
        }
        else if (c == '\n' || c == '\r') {
c01002d0:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c01002d4:	74 06                	je     c01002dc <readline+0x92>
c01002d6:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
c01002da:	75 1d                	jne    c01002f9 <readline+0xaf>
            cputchar(c);
c01002dc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002df:	89 04 24             	mov    %eax,(%esp)
c01002e2:	e8 92 00 00 00       	call   c0100379 <cputchar>
            buf[i] = '\0';
c01002e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01002ea:	05 c0 4a 12 c0       	add    $0xc0124ac0,%eax
c01002ef:	c6 00 00             	movb   $0x0,(%eax)
            return buf;
c01002f2:	b8 c0 4a 12 c0       	mov    $0xc0124ac0,%eax
c01002f7:	eb 05                	jmp    c01002fe <readline+0xb4>
        }
    }
c01002f9:	e9 72 ff ff ff       	jmp    c0100270 <readline+0x26>
}
c01002fe:	c9                   	leave  
c01002ff:	c3                   	ret    

c0100300 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c0100300:	55                   	push   %ebp
c0100301:	89 e5                	mov    %esp,%ebp
c0100303:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c0100306:	8b 45 08             	mov    0x8(%ebp),%eax
c0100309:	89 04 24             	mov    %eax,(%esp)
c010030c:	e8 44 12 00 00       	call   c0101555 <cons_putc>
    (*cnt) ++;
c0100311:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100314:	8b 00                	mov    (%eax),%eax
c0100316:	8d 50 01             	lea    0x1(%eax),%edx
c0100319:	8b 45 0c             	mov    0xc(%ebp),%eax
c010031c:	89 10                	mov    %edx,(%eax)
}
c010031e:	c9                   	leave  
c010031f:	c3                   	ret    

c0100320 <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c0100320:	55                   	push   %ebp
c0100321:	89 e5                	mov    %esp,%ebp
c0100323:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c0100326:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c010032d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100330:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0100334:	8b 45 08             	mov    0x8(%ebp),%eax
c0100337:	89 44 24 08          	mov    %eax,0x8(%esp)
c010033b:	8d 45 f4             	lea    -0xc(%ebp),%eax
c010033e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100342:	c7 04 24 00 03 10 c0 	movl   $0xc0100300,(%esp)
c0100349:	e8 00 8e 00 00       	call   c010914e <vprintfmt>
    return cnt;
c010034e:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100351:	c9                   	leave  
c0100352:	c3                   	ret    

c0100353 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c0100353:	55                   	push   %ebp
c0100354:	89 e5                	mov    %esp,%ebp
c0100356:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c0100359:	8d 45 0c             	lea    0xc(%ebp),%eax
c010035c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c010035f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100362:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100366:	8b 45 08             	mov    0x8(%ebp),%eax
c0100369:	89 04 24             	mov    %eax,(%esp)
c010036c:	e8 af ff ff ff       	call   c0100320 <vcprintf>
c0100371:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c0100374:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100377:	c9                   	leave  
c0100378:	c3                   	ret    

c0100379 <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c0100379:	55                   	push   %ebp
c010037a:	89 e5                	mov    %esp,%ebp
c010037c:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c010037f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100382:	89 04 24             	mov    %eax,(%esp)
c0100385:	e8 cb 11 00 00       	call   c0101555 <cons_putc>
}
c010038a:	c9                   	leave  
c010038b:	c3                   	ret    

c010038c <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c010038c:	55                   	push   %ebp
c010038d:	89 e5                	mov    %esp,%ebp
c010038f:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c0100392:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0100399:	eb 13                	jmp    c01003ae <cputs+0x22>
        cputch(c, &cnt);
c010039b:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010039f:	8d 55 f0             	lea    -0x10(%ebp),%edx
c01003a2:	89 54 24 04          	mov    %edx,0x4(%esp)
c01003a6:	89 04 24             	mov    %eax,(%esp)
c01003a9:	e8 52 ff ff ff       	call   c0100300 <cputch>
 * */
int
cputs(const char *str) {
    int cnt = 0;
    char c;
    while ((c = *str ++) != '\0') {
c01003ae:	8b 45 08             	mov    0x8(%ebp),%eax
c01003b1:	8d 50 01             	lea    0x1(%eax),%edx
c01003b4:	89 55 08             	mov    %edx,0x8(%ebp)
c01003b7:	0f b6 00             	movzbl (%eax),%eax
c01003ba:	88 45 f7             	mov    %al,-0x9(%ebp)
c01003bd:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c01003c1:	75 d8                	jne    c010039b <cputs+0xf>
        cputch(c, &cnt);
    }
    cputch('\n', &cnt);
c01003c3:	8d 45 f0             	lea    -0x10(%ebp),%eax
c01003c6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01003ca:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c01003d1:	e8 2a ff ff ff       	call   c0100300 <cputch>
    return cnt;
c01003d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c01003d9:	c9                   	leave  
c01003da:	c3                   	ret    

c01003db <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c01003db:	55                   	push   %ebp
c01003dc:	89 e5                	mov    %esp,%ebp
c01003de:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c01003e1:	e8 ab 11 00 00       	call   c0101591 <cons_getc>
c01003e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01003e9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01003ed:	74 f2                	je     c01003e1 <getchar+0x6>
        /* do nothing */;
    return c;
c01003ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01003f2:	c9                   	leave  
c01003f3:	c3                   	ret    

c01003f4 <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c01003f4:	55                   	push   %ebp
c01003f5:	89 e5                	mov    %esp,%ebp
c01003f7:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c01003fa:	8b 45 0c             	mov    0xc(%ebp),%eax
c01003fd:	8b 00                	mov    (%eax),%eax
c01003ff:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0100402:	8b 45 10             	mov    0x10(%ebp),%eax
c0100405:	8b 00                	mov    (%eax),%eax
c0100407:	89 45 f8             	mov    %eax,-0x8(%ebp)
c010040a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c0100411:	e9 d2 00 00 00       	jmp    c01004e8 <stab_binsearch+0xf4>
        int true_m = (l + r) / 2, m = true_m;
c0100416:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100419:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010041c:	01 d0                	add    %edx,%eax
c010041e:	89 c2                	mov    %eax,%edx
c0100420:	c1 ea 1f             	shr    $0x1f,%edx
c0100423:	01 d0                	add    %edx,%eax
c0100425:	d1 f8                	sar    %eax
c0100427:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010042a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010042d:	89 45 f0             	mov    %eax,-0x10(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100430:	eb 04                	jmp    c0100436 <stab_binsearch+0x42>
            m --;
c0100432:	83 6d f0 01          	subl   $0x1,-0x10(%ebp)

    while (l <= r) {
        int true_m = (l + r) / 2, m = true_m;

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100436:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100439:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010043c:	7c 1f                	jl     c010045d <stab_binsearch+0x69>
c010043e:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100441:	89 d0                	mov    %edx,%eax
c0100443:	01 c0                	add    %eax,%eax
c0100445:	01 d0                	add    %edx,%eax
c0100447:	c1 e0 02             	shl    $0x2,%eax
c010044a:	89 c2                	mov    %eax,%edx
c010044c:	8b 45 08             	mov    0x8(%ebp),%eax
c010044f:	01 d0                	add    %edx,%eax
c0100451:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100455:	0f b6 c0             	movzbl %al,%eax
c0100458:	3b 45 14             	cmp    0x14(%ebp),%eax
c010045b:	75 d5                	jne    c0100432 <stab_binsearch+0x3e>
            m --;
        }
        if (m < l) {    // no match in [l, m]
c010045d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100460:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100463:	7d 0b                	jge    c0100470 <stab_binsearch+0x7c>
            l = true_m + 1;
c0100465:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100468:	83 c0 01             	add    $0x1,%eax
c010046b:	89 45 fc             	mov    %eax,-0x4(%ebp)
            continue;
c010046e:	eb 78                	jmp    c01004e8 <stab_binsearch+0xf4>
        }

        // actual binary search
        any_matches = 1;
c0100470:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c0100477:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010047a:	89 d0                	mov    %edx,%eax
c010047c:	01 c0                	add    %eax,%eax
c010047e:	01 d0                	add    %edx,%eax
c0100480:	c1 e0 02             	shl    $0x2,%eax
c0100483:	89 c2                	mov    %eax,%edx
c0100485:	8b 45 08             	mov    0x8(%ebp),%eax
c0100488:	01 d0                	add    %edx,%eax
c010048a:	8b 40 08             	mov    0x8(%eax),%eax
c010048d:	3b 45 18             	cmp    0x18(%ebp),%eax
c0100490:	73 13                	jae    c01004a5 <stab_binsearch+0xb1>
            *region_left = m;
c0100492:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100495:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100498:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c010049a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010049d:	83 c0 01             	add    $0x1,%eax
c01004a0:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01004a3:	eb 43                	jmp    c01004e8 <stab_binsearch+0xf4>
        } else if (stabs[m].n_value > addr) {
c01004a5:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01004a8:	89 d0                	mov    %edx,%eax
c01004aa:	01 c0                	add    %eax,%eax
c01004ac:	01 d0                	add    %edx,%eax
c01004ae:	c1 e0 02             	shl    $0x2,%eax
c01004b1:	89 c2                	mov    %eax,%edx
c01004b3:	8b 45 08             	mov    0x8(%ebp),%eax
c01004b6:	01 d0                	add    %edx,%eax
c01004b8:	8b 40 08             	mov    0x8(%eax),%eax
c01004bb:	3b 45 18             	cmp    0x18(%ebp),%eax
c01004be:	76 16                	jbe    c01004d6 <stab_binsearch+0xe2>
            *region_right = m - 1;
c01004c0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004c3:	8d 50 ff             	lea    -0x1(%eax),%edx
c01004c6:	8b 45 10             	mov    0x10(%ebp),%eax
c01004c9:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c01004cb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004ce:	83 e8 01             	sub    $0x1,%eax
c01004d1:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01004d4:	eb 12                	jmp    c01004e8 <stab_binsearch+0xf4>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c01004d6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004d9:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01004dc:	89 10                	mov    %edx,(%eax)
            l = m;
c01004de:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01004e1:	89 45 fc             	mov    %eax,-0x4(%ebp)
            addr ++;
c01004e4:	83 45 18 01          	addl   $0x1,0x18(%ebp)
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
    int l = *region_left, r = *region_right, any_matches = 0;

    while (l <= r) {
c01004e8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01004eb:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c01004ee:	0f 8e 22 ff ff ff    	jle    c0100416 <stab_binsearch+0x22>
            l = m;
            addr ++;
        }
    }

    if (!any_matches) {
c01004f4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01004f8:	75 0f                	jne    c0100509 <stab_binsearch+0x115>
        *region_right = *region_left - 1;
c01004fa:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004fd:	8b 00                	mov    (%eax),%eax
c01004ff:	8d 50 ff             	lea    -0x1(%eax),%edx
c0100502:	8b 45 10             	mov    0x10(%ebp),%eax
c0100505:	89 10                	mov    %edx,(%eax)
c0100507:	eb 3f                	jmp    c0100548 <stab_binsearch+0x154>
    }
    else {
        // find rightmost region containing 'addr'
        l = *region_right;
c0100509:	8b 45 10             	mov    0x10(%ebp),%eax
c010050c:	8b 00                	mov    (%eax),%eax
c010050e:	89 45 fc             	mov    %eax,-0x4(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c0100511:	eb 04                	jmp    c0100517 <stab_binsearch+0x123>
c0100513:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
c0100517:	8b 45 0c             	mov    0xc(%ebp),%eax
c010051a:	8b 00                	mov    (%eax),%eax
c010051c:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010051f:	7d 1f                	jge    c0100540 <stab_binsearch+0x14c>
c0100521:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100524:	89 d0                	mov    %edx,%eax
c0100526:	01 c0                	add    %eax,%eax
c0100528:	01 d0                	add    %edx,%eax
c010052a:	c1 e0 02             	shl    $0x2,%eax
c010052d:	89 c2                	mov    %eax,%edx
c010052f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100532:	01 d0                	add    %edx,%eax
c0100534:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100538:	0f b6 c0             	movzbl %al,%eax
c010053b:	3b 45 14             	cmp    0x14(%ebp),%eax
c010053e:	75 d3                	jne    c0100513 <stab_binsearch+0x11f>
            /* do nothing */;
        *region_left = l;
c0100540:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100543:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100546:	89 10                	mov    %edx,(%eax)
    }
}
c0100548:	c9                   	leave  
c0100549:	c3                   	ret    

c010054a <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c010054a:	55                   	push   %ebp
c010054b:	89 e5                	mov    %esp,%ebp
c010054d:	83 ec 58             	sub    $0x58,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c0100550:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100553:	c7 00 4c 9c 10 c0    	movl   $0xc0109c4c,(%eax)
    info->eip_line = 0;
c0100559:	8b 45 0c             	mov    0xc(%ebp),%eax
c010055c:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c0100563:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100566:	c7 40 08 4c 9c 10 c0 	movl   $0xc0109c4c,0x8(%eax)
    info->eip_fn_namelen = 9;
c010056d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100570:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c0100577:	8b 45 0c             	mov    0xc(%ebp),%eax
c010057a:	8b 55 08             	mov    0x8(%ebp),%edx
c010057d:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c0100580:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100583:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    stabs = __STAB_BEGIN__;
c010058a:	c7 45 f4 30 bd 10 c0 	movl   $0xc010bd30,-0xc(%ebp)
    stab_end = __STAB_END__;
c0100591:	c7 45 f0 18 ce 11 c0 	movl   $0xc011ce18,-0x10(%ebp)
    stabstr = __STABSTR_BEGIN__;
c0100598:	c7 45 ec 19 ce 11 c0 	movl   $0xc011ce19,-0x14(%ebp)
    stabstr_end = __STABSTR_END__;
c010059f:	c7 45 e8 b4 15 12 c0 	movl   $0xc01215b4,-0x18(%ebp)

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c01005a6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01005a9:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01005ac:	76 0d                	jbe    c01005bb <debuginfo_eip+0x71>
c01005ae:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01005b1:	83 e8 01             	sub    $0x1,%eax
c01005b4:	0f b6 00             	movzbl (%eax),%eax
c01005b7:	84 c0                	test   %al,%al
c01005b9:	74 0a                	je     c01005c5 <debuginfo_eip+0x7b>
        return -1;
c01005bb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01005c0:	e9 c0 02 00 00       	jmp    c0100885 <debuginfo_eip+0x33b>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c01005c5:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c01005cc:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01005d2:	29 c2                	sub    %eax,%edx
c01005d4:	89 d0                	mov    %edx,%eax
c01005d6:	c1 f8 02             	sar    $0x2,%eax
c01005d9:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c01005df:	83 e8 01             	sub    $0x1,%eax
c01005e2:	89 45 e0             	mov    %eax,-0x20(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c01005e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01005e8:	89 44 24 10          	mov    %eax,0x10(%esp)
c01005ec:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c01005f3:	00 
c01005f4:	8d 45 e0             	lea    -0x20(%ebp),%eax
c01005f7:	89 44 24 08          	mov    %eax,0x8(%esp)
c01005fb:	8d 45 e4             	lea    -0x1c(%ebp),%eax
c01005fe:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100602:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100605:	89 04 24             	mov    %eax,(%esp)
c0100608:	e8 e7 fd ff ff       	call   c01003f4 <stab_binsearch>
    if (lfile == 0)
c010060d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100610:	85 c0                	test   %eax,%eax
c0100612:	75 0a                	jne    c010061e <debuginfo_eip+0xd4>
        return -1;
c0100614:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100619:	e9 67 02 00 00       	jmp    c0100885 <debuginfo_eip+0x33b>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c010061e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100621:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0100624:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100627:	89 45 d8             	mov    %eax,-0x28(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c010062a:	8b 45 08             	mov    0x8(%ebp),%eax
c010062d:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100631:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c0100638:	00 
c0100639:	8d 45 d8             	lea    -0x28(%ebp),%eax
c010063c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100640:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100643:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100647:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010064a:	89 04 24             	mov    %eax,(%esp)
c010064d:	e8 a2 fd ff ff       	call   c01003f4 <stab_binsearch>

    if (lfun <= rfun) {
c0100652:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100655:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100658:	39 c2                	cmp    %eax,%edx
c010065a:	7f 7c                	jg     c01006d8 <debuginfo_eip+0x18e>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c010065c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010065f:	89 c2                	mov    %eax,%edx
c0100661:	89 d0                	mov    %edx,%eax
c0100663:	01 c0                	add    %eax,%eax
c0100665:	01 d0                	add    %edx,%eax
c0100667:	c1 e0 02             	shl    $0x2,%eax
c010066a:	89 c2                	mov    %eax,%edx
c010066c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010066f:	01 d0                	add    %edx,%eax
c0100671:	8b 10                	mov    (%eax),%edx
c0100673:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c0100676:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100679:	29 c1                	sub    %eax,%ecx
c010067b:	89 c8                	mov    %ecx,%eax
c010067d:	39 c2                	cmp    %eax,%edx
c010067f:	73 22                	jae    c01006a3 <debuginfo_eip+0x159>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c0100681:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100684:	89 c2                	mov    %eax,%edx
c0100686:	89 d0                	mov    %edx,%eax
c0100688:	01 c0                	add    %eax,%eax
c010068a:	01 d0                	add    %edx,%eax
c010068c:	c1 e0 02             	shl    $0x2,%eax
c010068f:	89 c2                	mov    %eax,%edx
c0100691:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100694:	01 d0                	add    %edx,%eax
c0100696:	8b 10                	mov    (%eax),%edx
c0100698:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010069b:	01 c2                	add    %eax,%edx
c010069d:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006a0:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c01006a3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01006a6:	89 c2                	mov    %eax,%edx
c01006a8:	89 d0                	mov    %edx,%eax
c01006aa:	01 c0                	add    %eax,%eax
c01006ac:	01 d0                	add    %edx,%eax
c01006ae:	c1 e0 02             	shl    $0x2,%eax
c01006b1:	89 c2                	mov    %eax,%edx
c01006b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01006b6:	01 d0                	add    %edx,%eax
c01006b8:	8b 50 08             	mov    0x8(%eax),%edx
c01006bb:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006be:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c01006c1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006c4:	8b 40 10             	mov    0x10(%eax),%eax
c01006c7:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c01006ca:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01006cd:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfun;
c01006d0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01006d3:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01006d6:	eb 15                	jmp    c01006ed <debuginfo_eip+0x1a3>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c01006d8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006db:	8b 55 08             	mov    0x8(%ebp),%edx
c01006de:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c01006e1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01006e4:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfile;
c01006e7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01006ea:	89 45 d0             	mov    %eax,-0x30(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c01006ed:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006f0:	8b 40 08             	mov    0x8(%eax),%eax
c01006f3:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c01006fa:	00 
c01006fb:	89 04 24             	mov    %eax,(%esp)
c01006fe:	e8 7e 91 00 00       	call   c0109881 <strfind>
c0100703:	89 c2                	mov    %eax,%edx
c0100705:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100708:	8b 40 08             	mov    0x8(%eax),%eax
c010070b:	29 c2                	sub    %eax,%edx
c010070d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100710:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c0100713:	8b 45 08             	mov    0x8(%ebp),%eax
c0100716:	89 44 24 10          	mov    %eax,0x10(%esp)
c010071a:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c0100721:	00 
c0100722:	8d 45 d0             	lea    -0x30(%ebp),%eax
c0100725:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100729:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c010072c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100730:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100733:	89 04 24             	mov    %eax,(%esp)
c0100736:	e8 b9 fc ff ff       	call   c01003f4 <stab_binsearch>
    if (lline <= rline) {
c010073b:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010073e:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100741:	39 c2                	cmp    %eax,%edx
c0100743:	7f 24                	jg     c0100769 <debuginfo_eip+0x21f>
        info->eip_line = stabs[rline].n_desc;
c0100745:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100748:	89 c2                	mov    %eax,%edx
c010074a:	89 d0                	mov    %edx,%eax
c010074c:	01 c0                	add    %eax,%eax
c010074e:	01 d0                	add    %edx,%eax
c0100750:	c1 e0 02             	shl    $0x2,%eax
c0100753:	89 c2                	mov    %eax,%edx
c0100755:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100758:	01 d0                	add    %edx,%eax
c010075a:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c010075e:	0f b7 d0             	movzwl %ax,%edx
c0100761:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100764:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c0100767:	eb 13                	jmp    c010077c <debuginfo_eip+0x232>
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
    if (lline <= rline) {
        info->eip_line = stabs[rline].n_desc;
    } else {
        return -1;
c0100769:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c010076e:	e9 12 01 00 00       	jmp    c0100885 <debuginfo_eip+0x33b>
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c0100773:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100776:	83 e8 01             	sub    $0x1,%eax
c0100779:	89 45 d4             	mov    %eax,-0x2c(%ebp)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c010077c:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010077f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100782:	39 c2                	cmp    %eax,%edx
c0100784:	7c 56                	jl     c01007dc <debuginfo_eip+0x292>
           && stabs[lline].n_type != N_SOL
c0100786:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100789:	89 c2                	mov    %eax,%edx
c010078b:	89 d0                	mov    %edx,%eax
c010078d:	01 c0                	add    %eax,%eax
c010078f:	01 d0                	add    %edx,%eax
c0100791:	c1 e0 02             	shl    $0x2,%eax
c0100794:	89 c2                	mov    %eax,%edx
c0100796:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100799:	01 d0                	add    %edx,%eax
c010079b:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010079f:	3c 84                	cmp    $0x84,%al
c01007a1:	74 39                	je     c01007dc <debuginfo_eip+0x292>
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c01007a3:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01007a6:	89 c2                	mov    %eax,%edx
c01007a8:	89 d0                	mov    %edx,%eax
c01007aa:	01 c0                	add    %eax,%eax
c01007ac:	01 d0                	add    %edx,%eax
c01007ae:	c1 e0 02             	shl    $0x2,%eax
c01007b1:	89 c2                	mov    %eax,%edx
c01007b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007b6:	01 d0                	add    %edx,%eax
c01007b8:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01007bc:	3c 64                	cmp    $0x64,%al
c01007be:	75 b3                	jne    c0100773 <debuginfo_eip+0x229>
c01007c0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01007c3:	89 c2                	mov    %eax,%edx
c01007c5:	89 d0                	mov    %edx,%eax
c01007c7:	01 c0                	add    %eax,%eax
c01007c9:	01 d0                	add    %edx,%eax
c01007cb:	c1 e0 02             	shl    $0x2,%eax
c01007ce:	89 c2                	mov    %eax,%edx
c01007d0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007d3:	01 d0                	add    %edx,%eax
c01007d5:	8b 40 08             	mov    0x8(%eax),%eax
c01007d8:	85 c0                	test   %eax,%eax
c01007da:	74 97                	je     c0100773 <debuginfo_eip+0x229>
        lline --;
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c01007dc:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01007df:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01007e2:	39 c2                	cmp    %eax,%edx
c01007e4:	7c 46                	jl     c010082c <debuginfo_eip+0x2e2>
c01007e6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01007e9:	89 c2                	mov    %eax,%edx
c01007eb:	89 d0                	mov    %edx,%eax
c01007ed:	01 c0                	add    %eax,%eax
c01007ef:	01 d0                	add    %edx,%eax
c01007f1:	c1 e0 02             	shl    $0x2,%eax
c01007f4:	89 c2                	mov    %eax,%edx
c01007f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007f9:	01 d0                	add    %edx,%eax
c01007fb:	8b 10                	mov    (%eax),%edx
c01007fd:	8b 4d e8             	mov    -0x18(%ebp),%ecx
c0100800:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100803:	29 c1                	sub    %eax,%ecx
c0100805:	89 c8                	mov    %ecx,%eax
c0100807:	39 c2                	cmp    %eax,%edx
c0100809:	73 21                	jae    c010082c <debuginfo_eip+0x2e2>
        info->eip_file = stabstr + stabs[lline].n_strx;
c010080b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010080e:	89 c2                	mov    %eax,%edx
c0100810:	89 d0                	mov    %edx,%eax
c0100812:	01 c0                	add    %eax,%eax
c0100814:	01 d0                	add    %edx,%eax
c0100816:	c1 e0 02             	shl    $0x2,%eax
c0100819:	89 c2                	mov    %eax,%edx
c010081b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010081e:	01 d0                	add    %edx,%eax
c0100820:	8b 10                	mov    (%eax),%edx
c0100822:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100825:	01 c2                	add    %eax,%edx
c0100827:	8b 45 0c             	mov    0xc(%ebp),%eax
c010082a:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c010082c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010082f:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100832:	39 c2                	cmp    %eax,%edx
c0100834:	7d 4a                	jge    c0100880 <debuginfo_eip+0x336>
        for (lline = lfun + 1;
c0100836:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100839:	83 c0 01             	add    $0x1,%eax
c010083c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c010083f:	eb 18                	jmp    c0100859 <debuginfo_eip+0x30f>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0100841:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100844:	8b 40 14             	mov    0x14(%eax),%eax
c0100847:	8d 50 01             	lea    0x1(%eax),%edx
c010084a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010084d:	89 50 14             	mov    %edx,0x14(%eax)
    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
c0100850:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100853:	83 c0 01             	add    $0x1,%eax
c0100856:	89 45 d4             	mov    %eax,-0x2c(%ebp)

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100859:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010085c:	8b 45 d8             	mov    -0x28(%ebp),%eax
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
        for (lline = lfun + 1;
c010085f:	39 c2                	cmp    %eax,%edx
c0100861:	7d 1d                	jge    c0100880 <debuginfo_eip+0x336>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100863:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100866:	89 c2                	mov    %eax,%edx
c0100868:	89 d0                	mov    %edx,%eax
c010086a:	01 c0                	add    %eax,%eax
c010086c:	01 d0                	add    %edx,%eax
c010086e:	c1 e0 02             	shl    $0x2,%eax
c0100871:	89 c2                	mov    %eax,%edx
c0100873:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100876:	01 d0                	add    %edx,%eax
c0100878:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010087c:	3c a0                	cmp    $0xa0,%al
c010087e:	74 c1                	je     c0100841 <debuginfo_eip+0x2f7>
             lline ++) {
            info->eip_fn_narg ++;
        }
    }
    return 0;
c0100880:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100885:	c9                   	leave  
c0100886:	c3                   	ret    

c0100887 <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c0100887:	55                   	push   %ebp
c0100888:	89 e5                	mov    %esp,%ebp
c010088a:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c010088d:	c7 04 24 56 9c 10 c0 	movl   $0xc0109c56,(%esp)
c0100894:	e8 ba fa ff ff       	call   c0100353 <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c0100899:	c7 44 24 04 2a 00 10 	movl   $0xc010002a,0x4(%esp)
c01008a0:	c0 
c01008a1:	c7 04 24 6f 9c 10 c0 	movl   $0xc0109c6f,(%esp)
c01008a8:	e8 a6 fa ff ff       	call   c0100353 <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c01008ad:	c7 44 24 04 96 9b 10 	movl   $0xc0109b96,0x4(%esp)
c01008b4:	c0 
c01008b5:	c7 04 24 87 9c 10 c0 	movl   $0xc0109c87,(%esp)
c01008bc:	e8 92 fa ff ff       	call   c0100353 <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c01008c1:	c7 44 24 04 90 4a 12 	movl   $0xc0124a90,0x4(%esp)
c01008c8:	c0 
c01008c9:	c7 04 24 9f 9c 10 c0 	movl   $0xc0109c9f,(%esp)
c01008d0:	e8 7e fa ff ff       	call   c0100353 <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c01008d5:	c7 44 24 04 18 7c 12 	movl   $0xc0127c18,0x4(%esp)
c01008dc:	c0 
c01008dd:	c7 04 24 b7 9c 10 c0 	movl   $0xc0109cb7,(%esp)
c01008e4:	e8 6a fa ff ff       	call   c0100353 <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c01008e9:	b8 18 7c 12 c0       	mov    $0xc0127c18,%eax
c01008ee:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c01008f4:	b8 2a 00 10 c0       	mov    $0xc010002a,%eax
c01008f9:	29 c2                	sub    %eax,%edx
c01008fb:	89 d0                	mov    %edx,%eax
c01008fd:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0100903:	85 c0                	test   %eax,%eax
c0100905:	0f 48 c2             	cmovs  %edx,%eax
c0100908:	c1 f8 0a             	sar    $0xa,%eax
c010090b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010090f:	c7 04 24 d0 9c 10 c0 	movl   $0xc0109cd0,(%esp)
c0100916:	e8 38 fa ff ff       	call   c0100353 <cprintf>
}
c010091b:	c9                   	leave  
c010091c:	c3                   	ret    

c010091d <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c010091d:	55                   	push   %ebp
c010091e:	89 e5                	mov    %esp,%ebp
c0100920:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c0100926:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100929:	89 44 24 04          	mov    %eax,0x4(%esp)
c010092d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100930:	89 04 24             	mov    %eax,(%esp)
c0100933:	e8 12 fc ff ff       	call   c010054a <debuginfo_eip>
c0100938:	85 c0                	test   %eax,%eax
c010093a:	74 15                	je     c0100951 <print_debuginfo+0x34>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c010093c:	8b 45 08             	mov    0x8(%ebp),%eax
c010093f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100943:	c7 04 24 fa 9c 10 c0 	movl   $0xc0109cfa,(%esp)
c010094a:	e8 04 fa ff ff       	call   c0100353 <cprintf>
c010094f:	eb 6d                	jmp    c01009be <print_debuginfo+0xa1>
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100951:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100958:	eb 1c                	jmp    c0100976 <print_debuginfo+0x59>
            fnname[j] = info.eip_fn_name[j];
c010095a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010095d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100960:	01 d0                	add    %edx,%eax
c0100962:	0f b6 00             	movzbl (%eax),%eax
c0100965:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c010096b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010096e:	01 ca                	add    %ecx,%edx
c0100970:	88 02                	mov    %al,(%edx)
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
    }
    else {
        char fnname[256];
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100972:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0100976:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100979:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010097c:	7f dc                	jg     c010095a <print_debuginfo+0x3d>
            fnname[j] = info.eip_fn_name[j];
        }
        fnname[j] = '\0';
c010097e:	8d 95 dc fe ff ff    	lea    -0x124(%ebp),%edx
c0100984:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100987:	01 d0                	add    %edx,%eax
c0100989:	c6 00 00             	movb   $0x0,(%eax)
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
                fnname, eip - info.eip_fn_addr);
c010098c:	8b 45 ec             	mov    -0x14(%ebp),%eax
        int j;
        for (j = 0; j < info.eip_fn_namelen; j ++) {
            fnname[j] = info.eip_fn_name[j];
        }
        fnname[j] = '\0';
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c010098f:	8b 55 08             	mov    0x8(%ebp),%edx
c0100992:	89 d1                	mov    %edx,%ecx
c0100994:	29 c1                	sub    %eax,%ecx
c0100996:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100999:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010099c:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c01009a0:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c01009a6:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c01009aa:	89 54 24 08          	mov    %edx,0x8(%esp)
c01009ae:	89 44 24 04          	mov    %eax,0x4(%esp)
c01009b2:	c7 04 24 16 9d 10 c0 	movl   $0xc0109d16,(%esp)
c01009b9:	e8 95 f9 ff ff       	call   c0100353 <cprintf>
                fnname, eip - info.eip_fn_addr);
    }
}
c01009be:	c9                   	leave  
c01009bf:	c3                   	ret    

c01009c0 <read_eip>:

static __noinline uint32_t
read_eip(void) {
c01009c0:	55                   	push   %ebp
c01009c1:	89 e5                	mov    %esp,%ebp
c01009c3:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c01009c6:	8b 45 04             	mov    0x4(%ebp),%eax
c01009c9:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c01009cc:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c01009cf:	c9                   	leave  
c01009d0:	c3                   	ret    

c01009d1 <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c01009d1:	55                   	push   %ebp
c01009d2:	89 e5                	mov    %esp,%ebp
      *    (3.4) call print_debuginfo(eip-1) to print the C calling function name and line number, etc.
      *    (3.5) popup a calling stackframe
      *           NOTICE: the calling funciton's return addr eip  = ss:[ebp+4]
      *                   the calling funciton's ebp = ss:[ebp]
      */
}
c01009d4:	5d                   	pop    %ebp
c01009d5:	c3                   	ret    

c01009d6 <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c01009d6:	55                   	push   %ebp
c01009d7:	89 e5                	mov    %esp,%ebp
c01009d9:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c01009dc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c01009e3:	eb 0c                	jmp    c01009f1 <parse+0x1b>
            *buf ++ = '\0';
c01009e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01009e8:	8d 50 01             	lea    0x1(%eax),%edx
c01009eb:	89 55 08             	mov    %edx,0x8(%ebp)
c01009ee:	c6 00 00             	movb   $0x0,(%eax)
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c01009f1:	8b 45 08             	mov    0x8(%ebp),%eax
c01009f4:	0f b6 00             	movzbl (%eax),%eax
c01009f7:	84 c0                	test   %al,%al
c01009f9:	74 1d                	je     c0100a18 <parse+0x42>
c01009fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01009fe:	0f b6 00             	movzbl (%eax),%eax
c0100a01:	0f be c0             	movsbl %al,%eax
c0100a04:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a08:	c7 04 24 a8 9d 10 c0 	movl   $0xc0109da8,(%esp)
c0100a0f:	e8 3a 8e 00 00       	call   c010984e <strchr>
c0100a14:	85 c0                	test   %eax,%eax
c0100a16:	75 cd                	jne    c01009e5 <parse+0xf>
            *buf ++ = '\0';
        }
        if (*buf == '\0') {
c0100a18:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a1b:	0f b6 00             	movzbl (%eax),%eax
c0100a1e:	84 c0                	test   %al,%al
c0100a20:	75 02                	jne    c0100a24 <parse+0x4e>
            break;
c0100a22:	eb 67                	jmp    c0100a8b <parse+0xb5>
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c0100a24:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0100a28:	75 14                	jne    c0100a3e <parse+0x68>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0100a2a:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c0100a31:	00 
c0100a32:	c7 04 24 ad 9d 10 c0 	movl   $0xc0109dad,(%esp)
c0100a39:	e8 15 f9 ff ff       	call   c0100353 <cprintf>
        }
        argv[argc ++] = buf;
c0100a3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a41:	8d 50 01             	lea    0x1(%eax),%edx
c0100a44:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0100a47:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100a4e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100a51:	01 c2                	add    %eax,%edx
c0100a53:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a56:	89 02                	mov    %eax,(%edx)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100a58:	eb 04                	jmp    c0100a5e <parse+0x88>
            buf ++;
c0100a5a:	83 45 08 01          	addl   $0x1,0x8(%ebp)
        // save and scan past next arg
        if (argc == MAXARGS - 1) {
            cprintf("Too many arguments (max %d).\n", MAXARGS);
        }
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100a5e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a61:	0f b6 00             	movzbl (%eax),%eax
c0100a64:	84 c0                	test   %al,%al
c0100a66:	74 1d                	je     c0100a85 <parse+0xaf>
c0100a68:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a6b:	0f b6 00             	movzbl (%eax),%eax
c0100a6e:	0f be c0             	movsbl %al,%eax
c0100a71:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a75:	c7 04 24 a8 9d 10 c0 	movl   $0xc0109da8,(%esp)
c0100a7c:	e8 cd 8d 00 00       	call   c010984e <strchr>
c0100a81:	85 c0                	test   %eax,%eax
c0100a83:	74 d5                	je     c0100a5a <parse+0x84>
            buf ++;
        }
    }
c0100a85:	90                   	nop
static int
parse(char *buf, char **argv) {
    int argc = 0;
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100a86:	e9 66 ff ff ff       	jmp    c01009f1 <parse+0x1b>
        argv[argc ++] = buf;
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
            buf ++;
        }
    }
    return argc;
c0100a8b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100a8e:	c9                   	leave  
c0100a8f:	c3                   	ret    

c0100a90 <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c0100a90:	55                   	push   %ebp
c0100a91:	89 e5                	mov    %esp,%ebp
c0100a93:	83 ec 68             	sub    $0x68,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c0100a96:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100a99:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a9d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100aa0:	89 04 24             	mov    %eax,(%esp)
c0100aa3:	e8 2e ff ff ff       	call   c01009d6 <parse>
c0100aa8:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0100aab:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100aaf:	75 0a                	jne    c0100abb <runcmd+0x2b>
        return 0;
c0100ab1:	b8 00 00 00 00       	mov    $0x0,%eax
c0100ab6:	e9 85 00 00 00       	jmp    c0100b40 <runcmd+0xb0>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100abb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100ac2:	eb 5c                	jmp    c0100b20 <runcmd+0x90>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0100ac4:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0100ac7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100aca:	89 d0                	mov    %edx,%eax
c0100acc:	01 c0                	add    %eax,%eax
c0100ace:	01 d0                	add    %edx,%eax
c0100ad0:	c1 e0 02             	shl    $0x2,%eax
c0100ad3:	05 20 40 12 c0       	add    $0xc0124020,%eax
c0100ad8:	8b 00                	mov    (%eax),%eax
c0100ada:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0100ade:	89 04 24             	mov    %eax,(%esp)
c0100ae1:	e8 c9 8c 00 00       	call   c01097af <strcmp>
c0100ae6:	85 c0                	test   %eax,%eax
c0100ae8:	75 32                	jne    c0100b1c <runcmd+0x8c>
            return commands[i].func(argc - 1, argv + 1, tf);
c0100aea:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100aed:	89 d0                	mov    %edx,%eax
c0100aef:	01 c0                	add    %eax,%eax
c0100af1:	01 d0                	add    %edx,%eax
c0100af3:	c1 e0 02             	shl    $0x2,%eax
c0100af6:	05 20 40 12 c0       	add    $0xc0124020,%eax
c0100afb:	8b 40 08             	mov    0x8(%eax),%eax
c0100afe:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100b01:	8d 4a ff             	lea    -0x1(%edx),%ecx
c0100b04:	8b 55 0c             	mov    0xc(%ebp),%edx
c0100b07:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100b0b:	8d 55 b0             	lea    -0x50(%ebp),%edx
c0100b0e:	83 c2 04             	add    $0x4,%edx
c0100b11:	89 54 24 04          	mov    %edx,0x4(%esp)
c0100b15:	89 0c 24             	mov    %ecx,(%esp)
c0100b18:	ff d0                	call   *%eax
c0100b1a:	eb 24                	jmp    c0100b40 <runcmd+0xb0>
    int argc = parse(buf, argv);
    if (argc == 0) {
        return 0;
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100b1c:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0100b20:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b23:	83 f8 02             	cmp    $0x2,%eax
c0100b26:	76 9c                	jbe    c0100ac4 <runcmd+0x34>
        if (strcmp(commands[i].name, argv[0]) == 0) {
            return commands[i].func(argc - 1, argv + 1, tf);
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0100b28:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0100b2b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b2f:	c7 04 24 cb 9d 10 c0 	movl   $0xc0109dcb,(%esp)
c0100b36:	e8 18 f8 ff ff       	call   c0100353 <cprintf>
    return 0;
c0100b3b:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100b40:	c9                   	leave  
c0100b41:	c3                   	ret    

c0100b42 <kmonitor>:

/***** Implementations of basic kernel monitor commands *****/

void
kmonitor(struct trapframe *tf) {
c0100b42:	55                   	push   %ebp
c0100b43:	89 e5                	mov    %esp,%ebp
c0100b45:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c0100b48:	c7 04 24 e4 9d 10 c0 	movl   $0xc0109de4,(%esp)
c0100b4f:	e8 ff f7 ff ff       	call   c0100353 <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c0100b54:	c7 04 24 0c 9e 10 c0 	movl   $0xc0109e0c,(%esp)
c0100b5b:	e8 f3 f7 ff ff       	call   c0100353 <cprintf>

    if (tf != NULL) {
c0100b60:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100b64:	74 0b                	je     c0100b71 <kmonitor+0x2f>
        print_trapframe(tf);
c0100b66:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b69:	89 04 24             	mov    %eax,(%esp)
c0100b6c:	e8 26 16 00 00       	call   c0102197 <print_trapframe>
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c0100b71:	c7 04 24 31 9e 10 c0 	movl   $0xc0109e31,(%esp)
c0100b78:	e8 cd f6 ff ff       	call   c010024a <readline>
c0100b7d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100b80:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100b84:	74 18                	je     c0100b9e <kmonitor+0x5c>
            if (runcmd(buf, tf) < 0) {
c0100b86:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b89:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b8d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b90:	89 04 24             	mov    %eax,(%esp)
c0100b93:	e8 f8 fe ff ff       	call   c0100a90 <runcmd>
c0100b98:	85 c0                	test   %eax,%eax
c0100b9a:	79 02                	jns    c0100b9e <kmonitor+0x5c>
                break;
c0100b9c:	eb 02                	jmp    c0100ba0 <kmonitor+0x5e>
            }
        }
    }
c0100b9e:	eb d1                	jmp    c0100b71 <kmonitor+0x2f>
}
c0100ba0:	c9                   	leave  
c0100ba1:	c3                   	ret    

c0100ba2 <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0100ba2:	55                   	push   %ebp
c0100ba3:	89 e5                	mov    %esp,%ebp
c0100ba5:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100ba8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100baf:	eb 3f                	jmp    c0100bf0 <mon_help+0x4e>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c0100bb1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100bb4:	89 d0                	mov    %edx,%eax
c0100bb6:	01 c0                	add    %eax,%eax
c0100bb8:	01 d0                	add    %edx,%eax
c0100bba:	c1 e0 02             	shl    $0x2,%eax
c0100bbd:	05 20 40 12 c0       	add    $0xc0124020,%eax
c0100bc2:	8b 48 04             	mov    0x4(%eax),%ecx
c0100bc5:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100bc8:	89 d0                	mov    %edx,%eax
c0100bca:	01 c0                	add    %eax,%eax
c0100bcc:	01 d0                	add    %edx,%eax
c0100bce:	c1 e0 02             	shl    $0x2,%eax
c0100bd1:	05 20 40 12 c0       	add    $0xc0124020,%eax
c0100bd6:	8b 00                	mov    (%eax),%eax
c0100bd8:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100bdc:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100be0:	c7 04 24 35 9e 10 c0 	movl   $0xc0109e35,(%esp)
c0100be7:	e8 67 f7 ff ff       	call   c0100353 <cprintf>

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100bec:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0100bf0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100bf3:	83 f8 02             	cmp    $0x2,%eax
c0100bf6:	76 b9                	jbe    c0100bb1 <mon_help+0xf>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
    }
    return 0;
c0100bf8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100bfd:	c9                   	leave  
c0100bfe:	c3                   	ret    

c0100bff <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c0100bff:	55                   	push   %ebp
c0100c00:	89 e5                	mov    %esp,%ebp
c0100c02:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0100c05:	e8 7d fc ff ff       	call   c0100887 <print_kerninfo>
    return 0;
c0100c0a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c0f:	c9                   	leave  
c0100c10:	c3                   	ret    

c0100c11 <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c0100c11:	55                   	push   %ebp
c0100c12:	89 e5                	mov    %esp,%ebp
c0100c14:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0100c17:	e8 b5 fd ff ff       	call   c01009d1 <print_stackframe>
    return 0;
c0100c1c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c21:	c9                   	leave  
c0100c22:	c3                   	ret    

c0100c23 <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c0100c23:	55                   	push   %ebp
c0100c24:	89 e5                	mov    %esp,%ebp
c0100c26:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0100c29:	a1 c0 4e 12 c0       	mov    0xc0124ec0,%eax
c0100c2e:	85 c0                	test   %eax,%eax
c0100c30:	74 02                	je     c0100c34 <__panic+0x11>
        goto panic_dead;
c0100c32:	eb 48                	jmp    c0100c7c <__panic+0x59>
    }
    is_panic = 1;
c0100c34:	c7 05 c0 4e 12 c0 01 	movl   $0x1,0xc0124ec0
c0100c3b:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c0100c3e:	8d 45 14             	lea    0x14(%ebp),%eax
c0100c41:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0100c44:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c47:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100c4b:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c4e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c52:	c7 04 24 3e 9e 10 c0 	movl   $0xc0109e3e,(%esp)
c0100c59:	e8 f5 f6 ff ff       	call   c0100353 <cprintf>
    vcprintf(fmt, ap);
c0100c5e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c61:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c65:	8b 45 10             	mov    0x10(%ebp),%eax
c0100c68:	89 04 24             	mov    %eax,(%esp)
c0100c6b:	e8 b0 f6 ff ff       	call   c0100320 <vcprintf>
    cprintf("\n");
c0100c70:	c7 04 24 5a 9e 10 c0 	movl   $0xc0109e5a,(%esp)
c0100c77:	e8 d7 f6 ff ff       	call   c0100353 <cprintf>
    va_end(ap);

panic_dead:
    intr_disable();
c0100c7c:	e8 fa 11 00 00       	call   c0101e7b <intr_disable>
    while (1) {
        kmonitor(NULL);
c0100c81:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100c88:	e8 b5 fe ff ff       	call   c0100b42 <kmonitor>
    }
c0100c8d:	eb f2                	jmp    c0100c81 <__panic+0x5e>

c0100c8f <__warn>:
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c0100c8f:	55                   	push   %ebp
c0100c90:	89 e5                	mov    %esp,%ebp
c0100c92:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c0100c95:	8d 45 14             	lea    0x14(%ebp),%eax
c0100c98:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c0100c9b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100c9e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100ca2:	8b 45 08             	mov    0x8(%ebp),%eax
c0100ca5:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100ca9:	c7 04 24 5c 9e 10 c0 	movl   $0xc0109e5c,(%esp)
c0100cb0:	e8 9e f6 ff ff       	call   c0100353 <cprintf>
    vcprintf(fmt, ap);
c0100cb5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100cb8:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100cbc:	8b 45 10             	mov    0x10(%ebp),%eax
c0100cbf:	89 04 24             	mov    %eax,(%esp)
c0100cc2:	e8 59 f6 ff ff       	call   c0100320 <vcprintf>
    cprintf("\n");
c0100cc7:	c7 04 24 5a 9e 10 c0 	movl   $0xc0109e5a,(%esp)
c0100cce:	e8 80 f6 ff ff       	call   c0100353 <cprintf>
    va_end(ap);
}
c0100cd3:	c9                   	leave  
c0100cd4:	c3                   	ret    

c0100cd5 <is_kernel_panic>:

bool
is_kernel_panic(void) {
c0100cd5:	55                   	push   %ebp
c0100cd6:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0100cd8:	a1 c0 4e 12 c0       	mov    0xc0124ec0,%eax
}
c0100cdd:	5d                   	pop    %ebp
c0100cde:	c3                   	ret    

c0100cdf <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c0100cdf:	55                   	push   %ebp
c0100ce0:	89 e5                	mov    %esp,%ebp
c0100ce2:	83 ec 28             	sub    $0x28,%esp
c0100ce5:	66 c7 45 f6 43 00    	movw   $0x43,-0xa(%ebp)
c0100ceb:	c6 45 f5 34          	movb   $0x34,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100cef:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0100cf3:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100cf7:	ee                   	out    %al,(%dx)
c0100cf8:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c0100cfe:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
c0100d02:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100d06:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100d0a:	ee                   	out    %al,(%dx)
c0100d0b:	66 c7 45 ee 40 00    	movw   $0x40,-0x12(%ebp)
c0100d11:	c6 45 ed 2e          	movb   $0x2e,-0x13(%ebp)
c0100d15:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100d19:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0100d1d:	ee                   	out    %al,(%dx)
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c0100d1e:	c7 05 14 7b 12 c0 00 	movl   $0x0,0xc0127b14
c0100d25:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c0100d28:	c7 04 24 7a 9e 10 c0 	movl   $0xc0109e7a,(%esp)
c0100d2f:	e8 1f f6 ff ff       	call   c0100353 <cprintf>
    pic_enable(IRQ_TIMER);
c0100d34:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100d3b:	e8 99 11 00 00       	call   c0101ed9 <pic_enable>
}
c0100d40:	c9                   	leave  
c0100d41:	c3                   	ret    

c0100d42 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0100d42:	55                   	push   %ebp
c0100d43:	89 e5                	mov    %esp,%ebp
c0100d45:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0100d48:	9c                   	pushf  
c0100d49:	58                   	pop    %eax
c0100d4a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0100d4d:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0100d50:	25 00 02 00 00       	and    $0x200,%eax
c0100d55:	85 c0                	test   %eax,%eax
c0100d57:	74 0c                	je     c0100d65 <__intr_save+0x23>
        intr_disable();
c0100d59:	e8 1d 11 00 00       	call   c0101e7b <intr_disable>
        return 1;
c0100d5e:	b8 01 00 00 00       	mov    $0x1,%eax
c0100d63:	eb 05                	jmp    c0100d6a <__intr_save+0x28>
    }
    return 0;
c0100d65:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100d6a:	c9                   	leave  
c0100d6b:	c3                   	ret    

c0100d6c <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0100d6c:	55                   	push   %ebp
c0100d6d:	89 e5                	mov    %esp,%ebp
c0100d6f:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0100d72:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100d76:	74 05                	je     c0100d7d <__intr_restore+0x11>
        intr_enable();
c0100d78:	e8 f8 10 00 00       	call   c0101e75 <intr_enable>
    }
}
c0100d7d:	c9                   	leave  
c0100d7e:	c3                   	ret    

c0100d7f <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c0100d7f:	55                   	push   %ebp
c0100d80:	89 e5                	mov    %esp,%ebp
c0100d82:	83 ec 10             	sub    $0x10,%esp
c0100d85:	66 c7 45 fe 84 00    	movw   $0x84,-0x2(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100d8b:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0100d8f:	89 c2                	mov    %eax,%edx
c0100d91:	ec                   	in     (%dx),%al
c0100d92:	88 45 fd             	mov    %al,-0x3(%ebp)
c0100d95:	66 c7 45 fa 84 00    	movw   $0x84,-0x6(%ebp)
c0100d9b:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100d9f:	89 c2                	mov    %eax,%edx
c0100da1:	ec                   	in     (%dx),%al
c0100da2:	88 45 f9             	mov    %al,-0x7(%ebp)
c0100da5:	66 c7 45 f6 84 00    	movw   $0x84,-0xa(%ebp)
c0100dab:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100daf:	89 c2                	mov    %eax,%edx
c0100db1:	ec                   	in     (%dx),%al
c0100db2:	88 45 f5             	mov    %al,-0xb(%ebp)
c0100db5:	66 c7 45 f2 84 00    	movw   $0x84,-0xe(%ebp)
c0100dbb:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0100dbf:	89 c2                	mov    %eax,%edx
c0100dc1:	ec                   	in     (%dx),%al
c0100dc2:	88 45 f1             	mov    %al,-0xf(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c0100dc5:	c9                   	leave  
c0100dc6:	c3                   	ret    

c0100dc7 <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c0100dc7:	55                   	push   %ebp
c0100dc8:	89 e5                	mov    %esp,%ebp
c0100dca:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c0100dcd:	c7 45 fc 00 80 0b c0 	movl   $0xc00b8000,-0x4(%ebp)
    uint16_t was = *cp;
c0100dd4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100dd7:	0f b7 00             	movzwl (%eax),%eax
c0100dda:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    *cp = (uint16_t) 0xA55A;
c0100dde:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100de1:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c0100de6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100de9:	0f b7 00             	movzwl (%eax),%eax
c0100dec:	66 3d 5a a5          	cmp    $0xa55a,%ax
c0100df0:	74 12                	je     c0100e04 <cga_init+0x3d>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c0100df2:	c7 45 fc 00 00 0b c0 	movl   $0xc00b0000,-0x4(%ebp)
        addr_6845 = MONO_BASE;
c0100df9:	66 c7 05 e6 4e 12 c0 	movw   $0x3b4,0xc0124ee6
c0100e00:	b4 03 
c0100e02:	eb 13                	jmp    c0100e17 <cga_init+0x50>
    } else {
        *cp = was;
c0100e04:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e07:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0100e0b:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c0100e0e:	66 c7 05 e6 4e 12 c0 	movw   $0x3d4,0xc0124ee6
c0100e15:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c0100e17:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c0100e1e:	0f b7 c0             	movzwl %ax,%eax
c0100e21:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0100e25:	c6 45 f1 0e          	movb   $0xe,-0xf(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100e29:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100e2d:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100e31:	ee                   	out    %al,(%dx)
    pos = inb(addr_6845 + 1) << 8;
c0100e32:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c0100e39:	83 c0 01             	add    $0x1,%eax
c0100e3c:	0f b7 c0             	movzwl %ax,%eax
c0100e3f:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100e43:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c0100e47:	89 c2                	mov    %eax,%edx
c0100e49:	ec                   	in     (%dx),%al
c0100e4a:	88 45 ed             	mov    %al,-0x13(%ebp)
    return data;
c0100e4d:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100e51:	0f b6 c0             	movzbl %al,%eax
c0100e54:	c1 e0 08             	shl    $0x8,%eax
c0100e57:	89 45 f4             	mov    %eax,-0xc(%ebp)
    outb(addr_6845, 15);
c0100e5a:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c0100e61:	0f b7 c0             	movzwl %ax,%eax
c0100e64:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
c0100e68:	c6 45 e9 0f          	movb   $0xf,-0x17(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100e6c:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0100e70:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100e74:	ee                   	out    %al,(%dx)
    pos |= inb(addr_6845 + 1);
c0100e75:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c0100e7c:	83 c0 01             	add    $0x1,%eax
c0100e7f:	0f b7 c0             	movzwl %ax,%eax
c0100e82:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100e86:	0f b7 45 e6          	movzwl -0x1a(%ebp),%eax
c0100e8a:	89 c2                	mov    %eax,%edx
c0100e8c:	ec                   	in     (%dx),%al
c0100e8d:	88 45 e5             	mov    %al,-0x1b(%ebp)
    return data;
c0100e90:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0100e94:	0f b6 c0             	movzbl %al,%eax
c0100e97:	09 45 f4             	or     %eax,-0xc(%ebp)

    crt_buf = (uint16_t*) cp;
c0100e9a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100e9d:	a3 e0 4e 12 c0       	mov    %eax,0xc0124ee0
    crt_pos = pos;
c0100ea2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100ea5:	66 a3 e4 4e 12 c0    	mov    %ax,0xc0124ee4
}
c0100eab:	c9                   	leave  
c0100eac:	c3                   	ret    

c0100ead <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c0100ead:	55                   	push   %ebp
c0100eae:	89 e5                	mov    %esp,%ebp
c0100eb0:	83 ec 48             	sub    $0x48,%esp
c0100eb3:	66 c7 45 f6 fa 03    	movw   $0x3fa,-0xa(%ebp)
c0100eb9:	c6 45 f5 00          	movb   $0x0,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100ebd:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0100ec1:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100ec5:	ee                   	out    %al,(%dx)
c0100ec6:	66 c7 45 f2 fb 03    	movw   $0x3fb,-0xe(%ebp)
c0100ecc:	c6 45 f1 80          	movb   $0x80,-0xf(%ebp)
c0100ed0:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100ed4:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100ed8:	ee                   	out    %al,(%dx)
c0100ed9:	66 c7 45 ee f8 03    	movw   $0x3f8,-0x12(%ebp)
c0100edf:	c6 45 ed 0c          	movb   $0xc,-0x13(%ebp)
c0100ee3:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0100ee7:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0100eeb:	ee                   	out    %al,(%dx)
c0100eec:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c0100ef2:	c6 45 e9 00          	movb   $0x0,-0x17(%ebp)
c0100ef6:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0100efa:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100efe:	ee                   	out    %al,(%dx)
c0100eff:	66 c7 45 e6 fb 03    	movw   $0x3fb,-0x1a(%ebp)
c0100f05:	c6 45 e5 03          	movb   $0x3,-0x1b(%ebp)
c0100f09:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0100f0d:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0100f11:	ee                   	out    %al,(%dx)
c0100f12:	66 c7 45 e2 fc 03    	movw   $0x3fc,-0x1e(%ebp)
c0100f18:	c6 45 e1 00          	movb   $0x0,-0x1f(%ebp)
c0100f1c:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0100f20:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0100f24:	ee                   	out    %al,(%dx)
c0100f25:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c0100f2b:	c6 45 dd 01          	movb   $0x1,-0x23(%ebp)
c0100f2f:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0100f33:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0100f37:	ee                   	out    %al,(%dx)
c0100f38:	66 c7 45 da fd 03    	movw   $0x3fd,-0x26(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100f3e:	0f b7 45 da          	movzwl -0x26(%ebp),%eax
c0100f42:	89 c2                	mov    %eax,%edx
c0100f44:	ec                   	in     (%dx),%al
c0100f45:	88 45 d9             	mov    %al,-0x27(%ebp)
    return data;
c0100f48:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c0100f4c:	3c ff                	cmp    $0xff,%al
c0100f4e:	0f 95 c0             	setne  %al
c0100f51:	0f b6 c0             	movzbl %al,%eax
c0100f54:	a3 e8 4e 12 c0       	mov    %eax,0xc0124ee8
c0100f59:	66 c7 45 d6 fa 03    	movw   $0x3fa,-0x2a(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100f5f:	0f b7 45 d6          	movzwl -0x2a(%ebp),%eax
c0100f63:	89 c2                	mov    %eax,%edx
c0100f65:	ec                   	in     (%dx),%al
c0100f66:	88 45 d5             	mov    %al,-0x2b(%ebp)
c0100f69:	66 c7 45 d2 f8 03    	movw   $0x3f8,-0x2e(%ebp)
c0100f6f:	0f b7 45 d2          	movzwl -0x2e(%ebp),%eax
c0100f73:	89 c2                	mov    %eax,%edx
c0100f75:	ec                   	in     (%dx),%al
c0100f76:	88 45 d1             	mov    %al,-0x2f(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c0100f79:	a1 e8 4e 12 c0       	mov    0xc0124ee8,%eax
c0100f7e:	85 c0                	test   %eax,%eax
c0100f80:	74 0c                	je     c0100f8e <serial_init+0xe1>
        pic_enable(IRQ_COM1);
c0100f82:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0100f89:	e8 4b 0f 00 00       	call   c0101ed9 <pic_enable>
    }
}
c0100f8e:	c9                   	leave  
c0100f8f:	c3                   	ret    

c0100f90 <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0100f90:	55                   	push   %ebp
c0100f91:	89 e5                	mov    %esp,%ebp
c0100f93:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0100f96:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0100f9d:	eb 09                	jmp    c0100fa8 <lpt_putc_sub+0x18>
        delay();
c0100f9f:	e8 db fd ff ff       	call   c0100d7f <delay>
}

static void
lpt_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c0100fa4:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c0100fa8:	66 c7 45 fa 79 03    	movw   $0x379,-0x6(%ebp)
c0100fae:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100fb2:	89 c2                	mov    %eax,%edx
c0100fb4:	ec                   	in     (%dx),%al
c0100fb5:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0100fb8:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0100fbc:	84 c0                	test   %al,%al
c0100fbe:	78 09                	js     c0100fc9 <lpt_putc_sub+0x39>
c0100fc0:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0100fc7:	7e d6                	jle    c0100f9f <lpt_putc_sub+0xf>
        delay();
    }
    outb(LPTPORT + 0, c);
c0100fc9:	8b 45 08             	mov    0x8(%ebp),%eax
c0100fcc:	0f b6 c0             	movzbl %al,%eax
c0100fcf:	66 c7 45 f6 78 03    	movw   $0x378,-0xa(%ebp)
c0100fd5:	88 45 f5             	mov    %al,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100fd8:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0100fdc:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100fe0:	ee                   	out    %al,(%dx)
c0100fe1:	66 c7 45 f2 7a 03    	movw   $0x37a,-0xe(%ebp)
c0100fe7:	c6 45 f1 0d          	movb   $0xd,-0xf(%ebp)
c0100feb:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0100fef:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0100ff3:	ee                   	out    %al,(%dx)
c0100ff4:	66 c7 45 ee 7a 03    	movw   $0x37a,-0x12(%ebp)
c0100ffa:	c6 45 ed 08          	movb   $0x8,-0x13(%ebp)
c0100ffe:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101002:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101006:	ee                   	out    %al,(%dx)
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c0101007:	c9                   	leave  
c0101008:	c3                   	ret    

c0101009 <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c0101009:	55                   	push   %ebp
c010100a:	89 e5                	mov    %esp,%ebp
c010100c:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c010100f:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101013:	74 0d                	je     c0101022 <lpt_putc+0x19>
        lpt_putc_sub(c);
c0101015:	8b 45 08             	mov    0x8(%ebp),%eax
c0101018:	89 04 24             	mov    %eax,(%esp)
c010101b:	e8 70 ff ff ff       	call   c0100f90 <lpt_putc_sub>
c0101020:	eb 24                	jmp    c0101046 <lpt_putc+0x3d>
    }
    else {
        lpt_putc_sub('\b');
c0101022:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101029:	e8 62 ff ff ff       	call   c0100f90 <lpt_putc_sub>
        lpt_putc_sub(' ');
c010102e:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101035:	e8 56 ff ff ff       	call   c0100f90 <lpt_putc_sub>
        lpt_putc_sub('\b');
c010103a:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101041:	e8 4a ff ff ff       	call   c0100f90 <lpt_putc_sub>
    }
}
c0101046:	c9                   	leave  
c0101047:	c3                   	ret    

c0101048 <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c0101048:	55                   	push   %ebp
c0101049:	89 e5                	mov    %esp,%ebp
c010104b:	53                   	push   %ebx
c010104c:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c010104f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101052:	b0 00                	mov    $0x0,%al
c0101054:	85 c0                	test   %eax,%eax
c0101056:	75 07                	jne    c010105f <cga_putc+0x17>
        c |= 0x0700;
c0101058:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c010105f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101062:	0f b6 c0             	movzbl %al,%eax
c0101065:	83 f8 0a             	cmp    $0xa,%eax
c0101068:	74 4c                	je     c01010b6 <cga_putc+0x6e>
c010106a:	83 f8 0d             	cmp    $0xd,%eax
c010106d:	74 57                	je     c01010c6 <cga_putc+0x7e>
c010106f:	83 f8 08             	cmp    $0x8,%eax
c0101072:	0f 85 88 00 00 00    	jne    c0101100 <cga_putc+0xb8>
    case '\b':
        if (crt_pos > 0) {
c0101078:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c010107f:	66 85 c0             	test   %ax,%ax
c0101082:	74 30                	je     c01010b4 <cga_putc+0x6c>
            crt_pos --;
c0101084:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c010108b:	83 e8 01             	sub    $0x1,%eax
c010108e:	66 a3 e4 4e 12 c0    	mov    %ax,0xc0124ee4
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c0101094:	a1 e0 4e 12 c0       	mov    0xc0124ee0,%eax
c0101099:	0f b7 15 e4 4e 12 c0 	movzwl 0xc0124ee4,%edx
c01010a0:	0f b7 d2             	movzwl %dx,%edx
c01010a3:	01 d2                	add    %edx,%edx
c01010a5:	01 c2                	add    %eax,%edx
c01010a7:	8b 45 08             	mov    0x8(%ebp),%eax
c01010aa:	b0 00                	mov    $0x0,%al
c01010ac:	83 c8 20             	or     $0x20,%eax
c01010af:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c01010b2:	eb 72                	jmp    c0101126 <cga_putc+0xde>
c01010b4:	eb 70                	jmp    c0101126 <cga_putc+0xde>
    case '\n':
        crt_pos += CRT_COLS;
c01010b6:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c01010bd:	83 c0 50             	add    $0x50,%eax
c01010c0:	66 a3 e4 4e 12 c0    	mov    %ax,0xc0124ee4
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c01010c6:	0f b7 1d e4 4e 12 c0 	movzwl 0xc0124ee4,%ebx
c01010cd:	0f b7 0d e4 4e 12 c0 	movzwl 0xc0124ee4,%ecx
c01010d4:	0f b7 c1             	movzwl %cx,%eax
c01010d7:	69 c0 cd cc 00 00    	imul   $0xcccd,%eax,%eax
c01010dd:	c1 e8 10             	shr    $0x10,%eax
c01010e0:	89 c2                	mov    %eax,%edx
c01010e2:	66 c1 ea 06          	shr    $0x6,%dx
c01010e6:	89 d0                	mov    %edx,%eax
c01010e8:	c1 e0 02             	shl    $0x2,%eax
c01010eb:	01 d0                	add    %edx,%eax
c01010ed:	c1 e0 04             	shl    $0x4,%eax
c01010f0:	29 c1                	sub    %eax,%ecx
c01010f2:	89 ca                	mov    %ecx,%edx
c01010f4:	89 d8                	mov    %ebx,%eax
c01010f6:	29 d0                	sub    %edx,%eax
c01010f8:	66 a3 e4 4e 12 c0    	mov    %ax,0xc0124ee4
        break;
c01010fe:	eb 26                	jmp    c0101126 <cga_putc+0xde>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c0101100:	8b 0d e0 4e 12 c0    	mov    0xc0124ee0,%ecx
c0101106:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c010110d:	8d 50 01             	lea    0x1(%eax),%edx
c0101110:	66 89 15 e4 4e 12 c0 	mov    %dx,0xc0124ee4
c0101117:	0f b7 c0             	movzwl %ax,%eax
c010111a:	01 c0                	add    %eax,%eax
c010111c:	8d 14 01             	lea    (%ecx,%eax,1),%edx
c010111f:	8b 45 08             	mov    0x8(%ebp),%eax
c0101122:	66 89 02             	mov    %ax,(%edx)
        break;
c0101125:	90                   	nop
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c0101126:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c010112d:	66 3d cf 07          	cmp    $0x7cf,%ax
c0101131:	76 5b                	jbe    c010118e <cga_putc+0x146>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c0101133:	a1 e0 4e 12 c0       	mov    0xc0124ee0,%eax
c0101138:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c010113e:	a1 e0 4e 12 c0       	mov    0xc0124ee0,%eax
c0101143:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c010114a:	00 
c010114b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010114f:	89 04 24             	mov    %eax,(%esp)
c0101152:	e8 f5 88 00 00       	call   c0109a4c <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101157:	c7 45 f4 80 07 00 00 	movl   $0x780,-0xc(%ebp)
c010115e:	eb 15                	jmp    c0101175 <cga_putc+0x12d>
            crt_buf[i] = 0x0700 | ' ';
c0101160:	a1 e0 4e 12 c0       	mov    0xc0124ee0,%eax
c0101165:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101168:	01 d2                	add    %edx,%edx
c010116a:	01 d0                	add    %edx,%eax
c010116c:	66 c7 00 20 07       	movw   $0x720,(%eax)

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101171:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0101175:	81 7d f4 cf 07 00 00 	cmpl   $0x7cf,-0xc(%ebp)
c010117c:	7e e2                	jle    c0101160 <cga_putc+0x118>
            crt_buf[i] = 0x0700 | ' ';
        }
        crt_pos -= CRT_COLS;
c010117e:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c0101185:	83 e8 50             	sub    $0x50,%eax
c0101188:	66 a3 e4 4e 12 c0    	mov    %ax,0xc0124ee4
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c010118e:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c0101195:	0f b7 c0             	movzwl %ax,%eax
c0101198:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c010119c:	c6 45 f1 0e          	movb   $0xe,-0xf(%ebp)
c01011a0:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01011a4:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01011a8:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos >> 8);
c01011a9:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c01011b0:	66 c1 e8 08          	shr    $0x8,%ax
c01011b4:	0f b6 c0             	movzbl %al,%eax
c01011b7:	0f b7 15 e6 4e 12 c0 	movzwl 0xc0124ee6,%edx
c01011be:	83 c2 01             	add    $0x1,%edx
c01011c1:	0f b7 d2             	movzwl %dx,%edx
c01011c4:	66 89 55 ee          	mov    %dx,-0x12(%ebp)
c01011c8:	88 45 ed             	mov    %al,-0x13(%ebp)
c01011cb:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01011cf:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01011d3:	ee                   	out    %al,(%dx)
    outb(addr_6845, 15);
c01011d4:	0f b7 05 e6 4e 12 c0 	movzwl 0xc0124ee6,%eax
c01011db:	0f b7 c0             	movzwl %ax,%eax
c01011de:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
c01011e2:	c6 45 e9 0f          	movb   $0xf,-0x17(%ebp)
c01011e6:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01011ea:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01011ee:	ee                   	out    %al,(%dx)
    outb(addr_6845 + 1, crt_pos);
c01011ef:	0f b7 05 e4 4e 12 c0 	movzwl 0xc0124ee4,%eax
c01011f6:	0f b6 c0             	movzbl %al,%eax
c01011f9:	0f b7 15 e6 4e 12 c0 	movzwl 0xc0124ee6,%edx
c0101200:	83 c2 01             	add    $0x1,%edx
c0101203:	0f b7 d2             	movzwl %dx,%edx
c0101206:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c010120a:	88 45 e5             	mov    %al,-0x1b(%ebp)
c010120d:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101211:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101215:	ee                   	out    %al,(%dx)
}
c0101216:	83 c4 34             	add    $0x34,%esp
c0101219:	5b                   	pop    %ebx
c010121a:	5d                   	pop    %ebp
c010121b:	c3                   	ret    

c010121c <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c010121c:	55                   	push   %ebp
c010121d:	89 e5                	mov    %esp,%ebp
c010121f:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101222:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101229:	eb 09                	jmp    c0101234 <serial_putc_sub+0x18>
        delay();
c010122b:	e8 4f fb ff ff       	call   c0100d7f <delay>
}

static void
serial_putc_sub(int c) {
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101230:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c0101234:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010123a:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c010123e:	89 c2                	mov    %eax,%edx
c0101240:	ec                   	in     (%dx),%al
c0101241:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101244:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101248:	0f b6 c0             	movzbl %al,%eax
c010124b:	83 e0 20             	and    $0x20,%eax
c010124e:	85 c0                	test   %eax,%eax
c0101250:	75 09                	jne    c010125b <serial_putc_sub+0x3f>
c0101252:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101259:	7e d0                	jle    c010122b <serial_putc_sub+0xf>
        delay();
    }
    outb(COM1 + COM_TX, c);
c010125b:	8b 45 08             	mov    0x8(%ebp),%eax
c010125e:	0f b6 c0             	movzbl %al,%eax
c0101261:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101267:	88 45 f5             	mov    %al,-0xb(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010126a:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c010126e:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101272:	ee                   	out    %al,(%dx)
}
c0101273:	c9                   	leave  
c0101274:	c3                   	ret    

c0101275 <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c0101275:	55                   	push   %ebp
c0101276:	89 e5                	mov    %esp,%ebp
c0101278:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c010127b:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c010127f:	74 0d                	je     c010128e <serial_putc+0x19>
        serial_putc_sub(c);
c0101281:	8b 45 08             	mov    0x8(%ebp),%eax
c0101284:	89 04 24             	mov    %eax,(%esp)
c0101287:	e8 90 ff ff ff       	call   c010121c <serial_putc_sub>
c010128c:	eb 24                	jmp    c01012b2 <serial_putc+0x3d>
    }
    else {
        serial_putc_sub('\b');
c010128e:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101295:	e8 82 ff ff ff       	call   c010121c <serial_putc_sub>
        serial_putc_sub(' ');
c010129a:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c01012a1:	e8 76 ff ff ff       	call   c010121c <serial_putc_sub>
        serial_putc_sub('\b');
c01012a6:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c01012ad:	e8 6a ff ff ff       	call   c010121c <serial_putc_sub>
    }
}
c01012b2:	c9                   	leave  
c01012b3:	c3                   	ret    

c01012b4 <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c01012b4:	55                   	push   %ebp
c01012b5:	89 e5                	mov    %esp,%ebp
c01012b7:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c01012ba:	eb 33                	jmp    c01012ef <cons_intr+0x3b>
        if (c != 0) {
c01012bc:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01012c0:	74 2d                	je     c01012ef <cons_intr+0x3b>
            cons.buf[cons.wpos ++] = c;
c01012c2:	a1 04 51 12 c0       	mov    0xc0125104,%eax
c01012c7:	8d 50 01             	lea    0x1(%eax),%edx
c01012ca:	89 15 04 51 12 c0    	mov    %edx,0xc0125104
c01012d0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01012d3:	88 90 00 4f 12 c0    	mov    %dl,-0x3fedb100(%eax)
            if (cons.wpos == CONSBUFSIZE) {
c01012d9:	a1 04 51 12 c0       	mov    0xc0125104,%eax
c01012de:	3d 00 02 00 00       	cmp    $0x200,%eax
c01012e3:	75 0a                	jne    c01012ef <cons_intr+0x3b>
                cons.wpos = 0;
c01012e5:	c7 05 04 51 12 c0 00 	movl   $0x0,0xc0125104
c01012ec:	00 00 00 
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
    int c;
    while ((c = (*proc)()) != -1) {
c01012ef:	8b 45 08             	mov    0x8(%ebp),%eax
c01012f2:	ff d0                	call   *%eax
c01012f4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01012f7:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c01012fb:	75 bf                	jne    c01012bc <cons_intr+0x8>
            if (cons.wpos == CONSBUFSIZE) {
                cons.wpos = 0;
            }
        }
    }
}
c01012fd:	c9                   	leave  
c01012fe:	c3                   	ret    

c01012ff <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c01012ff:	55                   	push   %ebp
c0101300:	89 e5                	mov    %esp,%ebp
c0101302:	83 ec 10             	sub    $0x10,%esp
c0101305:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010130b:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c010130f:	89 c2                	mov    %eax,%edx
c0101311:	ec                   	in     (%dx),%al
c0101312:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101315:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c0101319:	0f b6 c0             	movzbl %al,%eax
c010131c:	83 e0 01             	and    $0x1,%eax
c010131f:	85 c0                	test   %eax,%eax
c0101321:	75 07                	jne    c010132a <serial_proc_data+0x2b>
        return -1;
c0101323:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101328:	eb 2a                	jmp    c0101354 <serial_proc_data+0x55>
c010132a:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101330:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101334:	89 c2                	mov    %eax,%edx
c0101336:	ec                   	in     (%dx),%al
c0101337:	88 45 f5             	mov    %al,-0xb(%ebp)
    return data;
c010133a:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c010133e:	0f b6 c0             	movzbl %al,%eax
c0101341:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (c == 127) {
c0101344:	83 7d fc 7f          	cmpl   $0x7f,-0x4(%ebp)
c0101348:	75 07                	jne    c0101351 <serial_proc_data+0x52>
        c = '\b';
c010134a:	c7 45 fc 08 00 00 00 	movl   $0x8,-0x4(%ebp)
    }
    return c;
c0101351:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101354:	c9                   	leave  
c0101355:	c3                   	ret    

c0101356 <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c0101356:	55                   	push   %ebp
c0101357:	89 e5                	mov    %esp,%ebp
c0101359:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c010135c:	a1 e8 4e 12 c0       	mov    0xc0124ee8,%eax
c0101361:	85 c0                	test   %eax,%eax
c0101363:	74 0c                	je     c0101371 <serial_intr+0x1b>
        cons_intr(serial_proc_data);
c0101365:	c7 04 24 ff 12 10 c0 	movl   $0xc01012ff,(%esp)
c010136c:	e8 43 ff ff ff       	call   c01012b4 <cons_intr>
    }
}
c0101371:	c9                   	leave  
c0101372:	c3                   	ret    

c0101373 <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c0101373:	55                   	push   %ebp
c0101374:	89 e5                	mov    %esp,%ebp
c0101376:	83 ec 38             	sub    $0x38,%esp
c0101379:	66 c7 45 f0 64 00    	movw   $0x64,-0x10(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010137f:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101383:	89 c2                	mov    %eax,%edx
c0101385:	ec                   	in     (%dx),%al
c0101386:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c0101389:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c010138d:	0f b6 c0             	movzbl %al,%eax
c0101390:	83 e0 01             	and    $0x1,%eax
c0101393:	85 c0                	test   %eax,%eax
c0101395:	75 0a                	jne    c01013a1 <kbd_proc_data+0x2e>
        return -1;
c0101397:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c010139c:	e9 59 01 00 00       	jmp    c01014fa <kbd_proc_data+0x187>
c01013a1:	66 c7 45 ec 60 00    	movw   $0x60,-0x14(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c01013a7:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c01013ab:	89 c2                	mov    %eax,%edx
c01013ad:	ec                   	in     (%dx),%al
c01013ae:	88 45 eb             	mov    %al,-0x15(%ebp)
    return data;
c01013b1:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
    }

    data = inb(KBDATAP);
c01013b5:	88 45 f3             	mov    %al,-0xd(%ebp)

    if (data == 0xE0) {
c01013b8:	80 7d f3 e0          	cmpb   $0xe0,-0xd(%ebp)
c01013bc:	75 17                	jne    c01013d5 <kbd_proc_data+0x62>
        // E0 escape character
        shift |= E0ESC;
c01013be:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c01013c3:	83 c8 40             	or     $0x40,%eax
c01013c6:	a3 08 51 12 c0       	mov    %eax,0xc0125108
        return 0;
c01013cb:	b8 00 00 00 00       	mov    $0x0,%eax
c01013d0:	e9 25 01 00 00       	jmp    c01014fa <kbd_proc_data+0x187>
    } else if (data & 0x80) {
c01013d5:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01013d9:	84 c0                	test   %al,%al
c01013db:	79 47                	jns    c0101424 <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c01013dd:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c01013e2:	83 e0 40             	and    $0x40,%eax
c01013e5:	85 c0                	test   %eax,%eax
c01013e7:	75 09                	jne    c01013f2 <kbd_proc_data+0x7f>
c01013e9:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01013ed:	83 e0 7f             	and    $0x7f,%eax
c01013f0:	eb 04                	jmp    c01013f6 <kbd_proc_data+0x83>
c01013f2:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01013f6:	88 45 f3             	mov    %al,-0xd(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c01013f9:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c01013fd:	0f b6 80 60 40 12 c0 	movzbl -0x3fedbfa0(%eax),%eax
c0101404:	83 c8 40             	or     $0x40,%eax
c0101407:	0f b6 c0             	movzbl %al,%eax
c010140a:	f7 d0                	not    %eax
c010140c:	89 c2                	mov    %eax,%edx
c010140e:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c0101413:	21 d0                	and    %edx,%eax
c0101415:	a3 08 51 12 c0       	mov    %eax,0xc0125108
        return 0;
c010141a:	b8 00 00 00 00       	mov    $0x0,%eax
c010141f:	e9 d6 00 00 00       	jmp    c01014fa <kbd_proc_data+0x187>
    } else if (shift & E0ESC) {
c0101424:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c0101429:	83 e0 40             	and    $0x40,%eax
c010142c:	85 c0                	test   %eax,%eax
c010142e:	74 11                	je     c0101441 <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c0101430:	80 4d f3 80          	orb    $0x80,-0xd(%ebp)
        shift &= ~E0ESC;
c0101434:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c0101439:	83 e0 bf             	and    $0xffffffbf,%eax
c010143c:	a3 08 51 12 c0       	mov    %eax,0xc0125108
    }

    shift |= shiftcode[data];
c0101441:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101445:	0f b6 80 60 40 12 c0 	movzbl -0x3fedbfa0(%eax),%eax
c010144c:	0f b6 d0             	movzbl %al,%edx
c010144f:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c0101454:	09 d0                	or     %edx,%eax
c0101456:	a3 08 51 12 c0       	mov    %eax,0xc0125108
    shift ^= togglecode[data];
c010145b:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c010145f:	0f b6 80 60 41 12 c0 	movzbl -0x3fedbea0(%eax),%eax
c0101466:	0f b6 d0             	movzbl %al,%edx
c0101469:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c010146e:	31 d0                	xor    %edx,%eax
c0101470:	a3 08 51 12 c0       	mov    %eax,0xc0125108

    c = charcode[shift & (CTL | SHIFT)][data];
c0101475:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c010147a:	83 e0 03             	and    $0x3,%eax
c010147d:	8b 14 85 60 45 12 c0 	mov    -0x3fedbaa0(,%eax,4),%edx
c0101484:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101488:	01 d0                	add    %edx,%eax
c010148a:	0f b6 00             	movzbl (%eax),%eax
c010148d:	0f b6 c0             	movzbl %al,%eax
c0101490:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (shift & CAPSLOCK) {
c0101493:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c0101498:	83 e0 08             	and    $0x8,%eax
c010149b:	85 c0                	test   %eax,%eax
c010149d:	74 22                	je     c01014c1 <kbd_proc_data+0x14e>
        if ('a' <= c && c <= 'z')
c010149f:	83 7d f4 60          	cmpl   $0x60,-0xc(%ebp)
c01014a3:	7e 0c                	jle    c01014b1 <kbd_proc_data+0x13e>
c01014a5:	83 7d f4 7a          	cmpl   $0x7a,-0xc(%ebp)
c01014a9:	7f 06                	jg     c01014b1 <kbd_proc_data+0x13e>
            c += 'A' - 'a';
c01014ab:	83 6d f4 20          	subl   $0x20,-0xc(%ebp)
c01014af:	eb 10                	jmp    c01014c1 <kbd_proc_data+0x14e>
        else if ('A' <= c && c <= 'Z')
c01014b1:	83 7d f4 40          	cmpl   $0x40,-0xc(%ebp)
c01014b5:	7e 0a                	jle    c01014c1 <kbd_proc_data+0x14e>
c01014b7:	83 7d f4 5a          	cmpl   $0x5a,-0xc(%ebp)
c01014bb:	7f 04                	jg     c01014c1 <kbd_proc_data+0x14e>
            c += 'a' - 'A';
c01014bd:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c01014c1:	a1 08 51 12 c0       	mov    0xc0125108,%eax
c01014c6:	f7 d0                	not    %eax
c01014c8:	83 e0 06             	and    $0x6,%eax
c01014cb:	85 c0                	test   %eax,%eax
c01014cd:	75 28                	jne    c01014f7 <kbd_proc_data+0x184>
c01014cf:	81 7d f4 e9 00 00 00 	cmpl   $0xe9,-0xc(%ebp)
c01014d6:	75 1f                	jne    c01014f7 <kbd_proc_data+0x184>
        cprintf("Rebooting!\n");
c01014d8:	c7 04 24 95 9e 10 c0 	movl   $0xc0109e95,(%esp)
c01014df:	e8 6f ee ff ff       	call   c0100353 <cprintf>
c01014e4:	66 c7 45 e8 92 00    	movw   $0x92,-0x18(%ebp)
c01014ea:	c6 45 e7 03          	movb   $0x3,-0x19(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01014ee:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
c01014f2:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
c01014f6:	ee                   	out    %al,(%dx)
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c01014f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01014fa:	c9                   	leave  
c01014fb:	c3                   	ret    

c01014fc <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c01014fc:	55                   	push   %ebp
c01014fd:	89 e5                	mov    %esp,%ebp
c01014ff:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c0101502:	c7 04 24 73 13 10 c0 	movl   $0xc0101373,(%esp)
c0101509:	e8 a6 fd ff ff       	call   c01012b4 <cons_intr>
}
c010150e:	c9                   	leave  
c010150f:	c3                   	ret    

c0101510 <kbd_init>:

static void
kbd_init(void) {
c0101510:	55                   	push   %ebp
c0101511:	89 e5                	mov    %esp,%ebp
c0101513:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c0101516:	e8 e1 ff ff ff       	call   c01014fc <kbd_intr>
    pic_enable(IRQ_KBD);
c010151b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0101522:	e8 b2 09 00 00       	call   c0101ed9 <pic_enable>
}
c0101527:	c9                   	leave  
c0101528:	c3                   	ret    

c0101529 <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c0101529:	55                   	push   %ebp
c010152a:	89 e5                	mov    %esp,%ebp
c010152c:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c010152f:	e8 93 f8 ff ff       	call   c0100dc7 <cga_init>
    serial_init();
c0101534:	e8 74 f9 ff ff       	call   c0100ead <serial_init>
    kbd_init();
c0101539:	e8 d2 ff ff ff       	call   c0101510 <kbd_init>
    if (!serial_exists) {
c010153e:	a1 e8 4e 12 c0       	mov    0xc0124ee8,%eax
c0101543:	85 c0                	test   %eax,%eax
c0101545:	75 0c                	jne    c0101553 <cons_init+0x2a>
        cprintf("serial port does not exist!!\n");
c0101547:	c7 04 24 a1 9e 10 c0 	movl   $0xc0109ea1,(%esp)
c010154e:	e8 00 ee ff ff       	call   c0100353 <cprintf>
    }
}
c0101553:	c9                   	leave  
c0101554:	c3                   	ret    

c0101555 <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c0101555:	55                   	push   %ebp
c0101556:	89 e5                	mov    %esp,%ebp
c0101558:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c010155b:	e8 e2 f7 ff ff       	call   c0100d42 <__intr_save>
c0101560:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c0101563:	8b 45 08             	mov    0x8(%ebp),%eax
c0101566:	89 04 24             	mov    %eax,(%esp)
c0101569:	e8 9b fa ff ff       	call   c0101009 <lpt_putc>
        cga_putc(c);
c010156e:	8b 45 08             	mov    0x8(%ebp),%eax
c0101571:	89 04 24             	mov    %eax,(%esp)
c0101574:	e8 cf fa ff ff       	call   c0101048 <cga_putc>
        serial_putc(c);
c0101579:	8b 45 08             	mov    0x8(%ebp),%eax
c010157c:	89 04 24             	mov    %eax,(%esp)
c010157f:	e8 f1 fc ff ff       	call   c0101275 <serial_putc>
    }
    local_intr_restore(intr_flag);
c0101584:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101587:	89 04 24             	mov    %eax,(%esp)
c010158a:	e8 dd f7 ff ff       	call   c0100d6c <__intr_restore>
}
c010158f:	c9                   	leave  
c0101590:	c3                   	ret    

c0101591 <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c0101591:	55                   	push   %ebp
c0101592:	89 e5                	mov    %esp,%ebp
c0101594:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c0101597:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c010159e:	e8 9f f7 ff ff       	call   c0100d42 <__intr_save>
c01015a3:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c01015a6:	e8 ab fd ff ff       	call   c0101356 <serial_intr>
        kbd_intr();
c01015ab:	e8 4c ff ff ff       	call   c01014fc <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c01015b0:	8b 15 00 51 12 c0    	mov    0xc0125100,%edx
c01015b6:	a1 04 51 12 c0       	mov    0xc0125104,%eax
c01015bb:	39 c2                	cmp    %eax,%edx
c01015bd:	74 31                	je     c01015f0 <cons_getc+0x5f>
            c = cons.buf[cons.rpos ++];
c01015bf:	a1 00 51 12 c0       	mov    0xc0125100,%eax
c01015c4:	8d 50 01             	lea    0x1(%eax),%edx
c01015c7:	89 15 00 51 12 c0    	mov    %edx,0xc0125100
c01015cd:	0f b6 80 00 4f 12 c0 	movzbl -0x3fedb100(%eax),%eax
c01015d4:	0f b6 c0             	movzbl %al,%eax
c01015d7:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (cons.rpos == CONSBUFSIZE) {
c01015da:	a1 00 51 12 c0       	mov    0xc0125100,%eax
c01015df:	3d 00 02 00 00       	cmp    $0x200,%eax
c01015e4:	75 0a                	jne    c01015f0 <cons_getc+0x5f>
                cons.rpos = 0;
c01015e6:	c7 05 00 51 12 c0 00 	movl   $0x0,0xc0125100
c01015ed:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c01015f0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01015f3:	89 04 24             	mov    %eax,(%esp)
c01015f6:	e8 71 f7 ff ff       	call   c0100d6c <__intr_restore>
    return c;
c01015fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01015fe:	c9                   	leave  
c01015ff:	c3                   	ret    

c0101600 <ide_wait_ready>:
    unsigned int size;          // Size in Sectors
    unsigned char model[41];    // Model in String
} ide_devices[MAX_IDE];

static int
ide_wait_ready(unsigned short iobase, bool check_error) {
c0101600:	55                   	push   %ebp
c0101601:	89 e5                	mov    %esp,%ebp
c0101603:	83 ec 14             	sub    $0x14,%esp
c0101606:	8b 45 08             	mov    0x8(%ebp),%eax
c0101609:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    int r;
    while ((r = inb(iobase + ISA_STATUS)) & IDE_BSY)
c010160d:	90                   	nop
c010160e:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101612:	83 c0 07             	add    $0x7,%eax
c0101615:	0f b7 c0             	movzwl %ax,%eax
c0101618:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010161c:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101620:	89 c2                	mov    %eax,%edx
c0101622:	ec                   	in     (%dx),%al
c0101623:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101626:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c010162a:	0f b6 c0             	movzbl %al,%eax
c010162d:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0101630:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101633:	25 80 00 00 00       	and    $0x80,%eax
c0101638:	85 c0                	test   %eax,%eax
c010163a:	75 d2                	jne    c010160e <ide_wait_ready+0xe>
        /* nothing */;
    if (check_error && (r & (IDE_DF | IDE_ERR)) != 0) {
c010163c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0101640:	74 11                	je     c0101653 <ide_wait_ready+0x53>
c0101642:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101645:	83 e0 21             	and    $0x21,%eax
c0101648:	85 c0                	test   %eax,%eax
c010164a:	74 07                	je     c0101653 <ide_wait_ready+0x53>
        return -1;
c010164c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101651:	eb 05                	jmp    c0101658 <ide_wait_ready+0x58>
    }
    return 0;
c0101653:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101658:	c9                   	leave  
c0101659:	c3                   	ret    

c010165a <ide_init>:

void
ide_init(void) {
c010165a:	55                   	push   %ebp
c010165b:	89 e5                	mov    %esp,%ebp
c010165d:	57                   	push   %edi
c010165e:	53                   	push   %ebx
c010165f:	81 ec 50 02 00 00    	sub    $0x250,%esp
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0101665:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
c010166b:	e9 d6 02 00 00       	jmp    c0101946 <ide_init+0x2ec>
        /* assume that no device here */
        ide_devices[ideno].valid = 0;
c0101670:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101674:	c1 e0 03             	shl    $0x3,%eax
c0101677:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c010167e:	29 c2                	sub    %eax,%edx
c0101680:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c0101686:	c6 00 00             	movb   $0x0,(%eax)

        iobase = IO_BASE(ideno);
c0101689:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010168d:	66 d1 e8             	shr    %ax
c0101690:	0f b7 c0             	movzwl %ax,%eax
c0101693:	0f b7 04 85 c0 9e 10 	movzwl -0x3fef6140(,%eax,4),%eax
c010169a:	c0 
c010169b:	66 89 45 ea          	mov    %ax,-0x16(%ebp)

        /* wait device ready */
        ide_wait_ready(iobase, 0);
c010169f:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01016a3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01016aa:	00 
c01016ab:	89 04 24             	mov    %eax,(%esp)
c01016ae:	e8 4d ff ff ff       	call   c0101600 <ide_wait_ready>

        /* step1: select drive */
        outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4));
c01016b3:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01016b7:	83 e0 01             	and    $0x1,%eax
c01016ba:	c1 e0 04             	shl    $0x4,%eax
c01016bd:	83 c8 e0             	or     $0xffffffe0,%eax
c01016c0:	0f b6 c0             	movzbl %al,%eax
c01016c3:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01016c7:	83 c2 06             	add    $0x6,%edx
c01016ca:	0f b7 d2             	movzwl %dx,%edx
c01016cd:	66 89 55 d2          	mov    %dx,-0x2e(%ebp)
c01016d1:	88 45 d1             	mov    %al,-0x2f(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01016d4:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c01016d8:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c01016dc:	ee                   	out    %al,(%dx)
        ide_wait_ready(iobase, 0);
c01016dd:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01016e1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01016e8:	00 
c01016e9:	89 04 24             	mov    %eax,(%esp)
c01016ec:	e8 0f ff ff ff       	call   c0101600 <ide_wait_ready>

        /* step2: send ATA identify command */
        outb(iobase + ISA_COMMAND, IDE_CMD_IDENTIFY);
c01016f1:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c01016f5:	83 c0 07             	add    $0x7,%eax
c01016f8:	0f b7 c0             	movzwl %ax,%eax
c01016fb:	66 89 45 ce          	mov    %ax,-0x32(%ebp)
c01016ff:	c6 45 cd ec          	movb   $0xec,-0x33(%ebp)
c0101703:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0101707:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c010170b:	ee                   	out    %al,(%dx)
        ide_wait_ready(iobase, 0);
c010170c:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101710:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101717:	00 
c0101718:	89 04 24             	mov    %eax,(%esp)
c010171b:	e8 e0 fe ff ff       	call   c0101600 <ide_wait_ready>

        /* step3: polling */
        if (inb(iobase + ISA_STATUS) == 0 || ide_wait_ready(iobase, 1) != 0) {
c0101720:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101724:	83 c0 07             	add    $0x7,%eax
c0101727:	0f b7 c0             	movzwl %ax,%eax
c010172a:	66 89 45 ca          	mov    %ax,-0x36(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010172e:	0f b7 45 ca          	movzwl -0x36(%ebp),%eax
c0101732:	89 c2                	mov    %eax,%edx
c0101734:	ec                   	in     (%dx),%al
c0101735:	88 45 c9             	mov    %al,-0x37(%ebp)
    return data;
c0101738:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c010173c:	84 c0                	test   %al,%al
c010173e:	0f 84 f7 01 00 00    	je     c010193b <ide_init+0x2e1>
c0101744:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0101748:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010174f:	00 
c0101750:	89 04 24             	mov    %eax,(%esp)
c0101753:	e8 a8 fe ff ff       	call   c0101600 <ide_wait_ready>
c0101758:	85 c0                	test   %eax,%eax
c010175a:	0f 85 db 01 00 00    	jne    c010193b <ide_init+0x2e1>
            continue ;
        }

        /* device is ok */
        ide_devices[ideno].valid = 1;
c0101760:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101764:	c1 e0 03             	shl    $0x3,%eax
c0101767:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c010176e:	29 c2                	sub    %eax,%edx
c0101770:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c0101776:	c6 00 01             	movb   $0x1,(%eax)

        /* read identification space of the device */
        unsigned int buffer[128];
        insl(iobase + ISA_DATA, buffer, sizeof(buffer) / sizeof(unsigned int));
c0101779:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c010177d:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0101780:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0101786:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0101789:	c7 45 bc 80 00 00 00 	movl   $0x80,-0x44(%ebp)
}

static inline void
insl(uint32_t port, void *addr, int cnt) {
    asm volatile (
c0101790:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0101793:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c0101796:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0101799:	89 cb                	mov    %ecx,%ebx
c010179b:	89 df                	mov    %ebx,%edi
c010179d:	89 c1                	mov    %eax,%ecx
c010179f:	fc                   	cld    
c01017a0:	f2 6d                	repnz insl (%dx),%es:(%edi)
c01017a2:	89 c8                	mov    %ecx,%eax
c01017a4:	89 fb                	mov    %edi,%ebx
c01017a6:	89 5d c0             	mov    %ebx,-0x40(%ebp)
c01017a9:	89 45 bc             	mov    %eax,-0x44(%ebp)

        unsigned char *ident = (unsigned char *)buffer;
c01017ac:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c01017b2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unsigned int sectors;
        unsigned int cmdsets = *(unsigned int *)(ident + IDE_IDENT_CMDSETS);
c01017b5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01017b8:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
c01017be:	89 45 e0             	mov    %eax,-0x20(%ebp)
        /* device use 48-bits or 28-bits addressing */
        if (cmdsets & (1 << 26)) {
c01017c1:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01017c4:	25 00 00 00 04       	and    $0x4000000,%eax
c01017c9:	85 c0                	test   %eax,%eax
c01017cb:	74 0e                	je     c01017db <ide_init+0x181>
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA_EXT);
c01017cd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01017d0:	8b 80 c8 00 00 00    	mov    0xc8(%eax),%eax
c01017d6:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01017d9:	eb 09                	jmp    c01017e4 <ide_init+0x18a>
        }
        else {
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA);
c01017db:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01017de:	8b 40 78             	mov    0x78(%eax),%eax
c01017e1:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        ide_devices[ideno].sets = cmdsets;
c01017e4:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01017e8:	c1 e0 03             	shl    $0x3,%eax
c01017eb:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01017f2:	29 c2                	sub    %eax,%edx
c01017f4:	81 c2 20 51 12 c0    	add    $0xc0125120,%edx
c01017fa:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01017fd:	89 42 04             	mov    %eax,0x4(%edx)
        ide_devices[ideno].size = sectors;
c0101800:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101804:	c1 e0 03             	shl    $0x3,%eax
c0101807:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c010180e:	29 c2                	sub    %eax,%edx
c0101810:	81 c2 20 51 12 c0    	add    $0xc0125120,%edx
c0101816:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101819:	89 42 08             	mov    %eax,0x8(%edx)

        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);
c010181c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010181f:	83 c0 62             	add    $0x62,%eax
c0101822:	0f b7 00             	movzwl (%eax),%eax
c0101825:	0f b7 c0             	movzwl %ax,%eax
c0101828:	25 00 02 00 00       	and    $0x200,%eax
c010182d:	85 c0                	test   %eax,%eax
c010182f:	75 24                	jne    c0101855 <ide_init+0x1fb>
c0101831:	c7 44 24 0c c8 9e 10 	movl   $0xc0109ec8,0xc(%esp)
c0101838:	c0 
c0101839:	c7 44 24 08 0b 9f 10 	movl   $0xc0109f0b,0x8(%esp)
c0101840:	c0 
c0101841:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c0101848:	00 
c0101849:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c0101850:	e8 ce f3 ff ff       	call   c0100c23 <__panic>

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
c0101855:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101859:	c1 e0 03             	shl    $0x3,%eax
c010185c:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101863:	29 c2                	sub    %eax,%edx
c0101865:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c010186b:	83 c0 0c             	add    $0xc,%eax
c010186e:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0101871:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0101874:	83 c0 36             	add    $0x36,%eax
c0101877:	89 45 d8             	mov    %eax,-0x28(%ebp)
        unsigned int i, length = 40;
c010187a:	c7 45 d4 28 00 00 00 	movl   $0x28,-0x2c(%ebp)
        for (i = 0; i < length; i += 2) {
c0101881:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0101888:	eb 34                	jmp    c01018be <ide_init+0x264>
            model[i] = data[i + 1], model[i + 1] = data[i];
c010188a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010188d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101890:	01 c2                	add    %eax,%edx
c0101892:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101895:	8d 48 01             	lea    0x1(%eax),%ecx
c0101898:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010189b:	01 c8                	add    %ecx,%eax
c010189d:	0f b6 00             	movzbl (%eax),%eax
c01018a0:	88 02                	mov    %al,(%edx)
c01018a2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018a5:	8d 50 01             	lea    0x1(%eax),%edx
c01018a8:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01018ab:	01 c2                	add    %eax,%edx
c01018ad:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018b0:	8b 4d d8             	mov    -0x28(%ebp),%ecx
c01018b3:	01 c8                	add    %ecx,%eax
c01018b5:	0f b6 00             	movzbl (%eax),%eax
c01018b8:	88 02                	mov    %al,(%edx)
        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
        unsigned int i, length = 40;
        for (i = 0; i < length; i += 2) {
c01018ba:	83 45 ec 02          	addl   $0x2,-0x14(%ebp)
c01018be:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018c1:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c01018c4:	72 c4                	jb     c010188a <ide_init+0x230>
            model[i] = data[i + 1], model[i + 1] = data[i];
        }
        do {
            model[i] = '\0';
c01018c6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018c9:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01018cc:	01 d0                	add    %edx,%eax
c01018ce:	c6 00 00             	movb   $0x0,(%eax)
        } while (i -- > 0 && model[i] == ' ');
c01018d1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018d4:	8d 50 ff             	lea    -0x1(%eax),%edx
c01018d7:	89 55 ec             	mov    %edx,-0x14(%ebp)
c01018da:	85 c0                	test   %eax,%eax
c01018dc:	74 0f                	je     c01018ed <ide_init+0x293>
c01018de:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01018e1:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01018e4:	01 d0                	add    %edx,%eax
c01018e6:	0f b6 00             	movzbl (%eax),%eax
c01018e9:	3c 20                	cmp    $0x20,%al
c01018eb:	74 d9                	je     c01018c6 <ide_init+0x26c>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
c01018ed:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c01018f1:	c1 e0 03             	shl    $0x3,%eax
c01018f4:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01018fb:	29 c2                	sub    %eax,%edx
c01018fd:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c0101903:	8d 48 0c             	lea    0xc(%eax),%ecx
c0101906:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010190a:	c1 e0 03             	shl    $0x3,%eax
c010190d:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101914:	29 c2                	sub    %eax,%edx
c0101916:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c010191c:	8b 50 08             	mov    0x8(%eax),%edx
c010191f:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101923:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0101927:	89 54 24 08          	mov    %edx,0x8(%esp)
c010192b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010192f:	c7 04 24 32 9f 10 c0 	movl   $0xc0109f32,(%esp)
c0101936:	e8 18 ea ff ff       	call   c0100353 <cprintf>

void
ide_init(void) {
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c010193b:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010193f:	83 c0 01             	add    $0x1,%eax
c0101942:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
c0101946:	66 83 7d f6 03       	cmpw   $0x3,-0xa(%ebp)
c010194b:	0f 86 1f fd ff ff    	jbe    c0101670 <ide_init+0x16>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
    }

    // enable ide interrupt
    pic_enable(IRQ_IDE1);
c0101951:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
c0101958:	e8 7c 05 00 00       	call   c0101ed9 <pic_enable>
    pic_enable(IRQ_IDE2);
c010195d:	c7 04 24 0f 00 00 00 	movl   $0xf,(%esp)
c0101964:	e8 70 05 00 00       	call   c0101ed9 <pic_enable>
}
c0101969:	81 c4 50 02 00 00    	add    $0x250,%esp
c010196f:	5b                   	pop    %ebx
c0101970:	5f                   	pop    %edi
c0101971:	5d                   	pop    %ebp
c0101972:	c3                   	ret    

c0101973 <ide_device_valid>:

bool
ide_device_valid(unsigned short ideno) {
c0101973:	55                   	push   %ebp
c0101974:	89 e5                	mov    %esp,%ebp
c0101976:	83 ec 04             	sub    $0x4,%esp
c0101979:	8b 45 08             	mov    0x8(%ebp),%eax
c010197c:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    return VALID_IDE(ideno);
c0101980:	66 83 7d fc 03       	cmpw   $0x3,-0x4(%ebp)
c0101985:	77 24                	ja     c01019ab <ide_device_valid+0x38>
c0101987:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c010198b:	c1 e0 03             	shl    $0x3,%eax
c010198e:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101995:	29 c2                	sub    %eax,%edx
c0101997:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c010199d:	0f b6 00             	movzbl (%eax),%eax
c01019a0:	84 c0                	test   %al,%al
c01019a2:	74 07                	je     c01019ab <ide_device_valid+0x38>
c01019a4:	b8 01 00 00 00       	mov    $0x1,%eax
c01019a9:	eb 05                	jmp    c01019b0 <ide_device_valid+0x3d>
c01019ab:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01019b0:	c9                   	leave  
c01019b1:	c3                   	ret    

c01019b2 <ide_device_size>:

size_t
ide_device_size(unsigned short ideno) {
c01019b2:	55                   	push   %ebp
c01019b3:	89 e5                	mov    %esp,%ebp
c01019b5:	83 ec 08             	sub    $0x8,%esp
c01019b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01019bb:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    if (ide_device_valid(ideno)) {
c01019bf:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01019c3:	89 04 24             	mov    %eax,(%esp)
c01019c6:	e8 a8 ff ff ff       	call   c0101973 <ide_device_valid>
c01019cb:	85 c0                	test   %eax,%eax
c01019cd:	74 1b                	je     c01019ea <ide_device_size+0x38>
        return ide_devices[ideno].size;
c01019cf:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01019d3:	c1 e0 03             	shl    $0x3,%eax
c01019d6:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01019dd:	29 c2                	sub    %eax,%edx
c01019df:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c01019e5:	8b 40 08             	mov    0x8(%eax),%eax
c01019e8:	eb 05                	jmp    c01019ef <ide_device_size+0x3d>
    }
    return 0;
c01019ea:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01019ef:	c9                   	leave  
c01019f0:	c3                   	ret    

c01019f1 <ide_read_secs>:

int
ide_read_secs(unsigned short ideno, uint32_t secno, void *dst, size_t nsecs) {
c01019f1:	55                   	push   %ebp
c01019f2:	89 e5                	mov    %esp,%ebp
c01019f4:	57                   	push   %edi
c01019f5:	53                   	push   %ebx
c01019f6:	83 ec 50             	sub    $0x50,%esp
c01019f9:	8b 45 08             	mov    0x8(%ebp),%eax
c01019fc:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101a00:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101a07:	77 24                	ja     c0101a2d <ide_read_secs+0x3c>
c0101a09:	66 83 7d c4 03       	cmpw   $0x3,-0x3c(%ebp)
c0101a0e:	77 1d                	ja     c0101a2d <ide_read_secs+0x3c>
c0101a10:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101a14:	c1 e0 03             	shl    $0x3,%eax
c0101a17:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101a1e:	29 c2                	sub    %eax,%edx
c0101a20:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c0101a26:	0f b6 00             	movzbl (%eax),%eax
c0101a29:	84 c0                	test   %al,%al
c0101a2b:	75 24                	jne    c0101a51 <ide_read_secs+0x60>
c0101a2d:	c7 44 24 0c 50 9f 10 	movl   $0xc0109f50,0xc(%esp)
c0101a34:	c0 
c0101a35:	c7 44 24 08 0b 9f 10 	movl   $0xc0109f0b,0x8(%esp)
c0101a3c:	c0 
c0101a3d:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c0101a44:	00 
c0101a45:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c0101a4c:	e8 d2 f1 ff ff       	call   c0100c23 <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101a51:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101a58:	77 0f                	ja     c0101a69 <ide_read_secs+0x78>
c0101a5a:	8b 45 14             	mov    0x14(%ebp),%eax
c0101a5d:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101a60:	01 d0                	add    %edx,%eax
c0101a62:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c0101a67:	76 24                	jbe    c0101a8d <ide_read_secs+0x9c>
c0101a69:	c7 44 24 0c 78 9f 10 	movl   $0xc0109f78,0xc(%esp)
c0101a70:	c0 
c0101a71:	c7 44 24 08 0b 9f 10 	movl   $0xc0109f0b,0x8(%esp)
c0101a78:	c0 
c0101a79:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c0101a80:	00 
c0101a81:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c0101a88:	e8 96 f1 ff ff       	call   c0100c23 <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c0101a8d:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101a91:	66 d1 e8             	shr    %ax
c0101a94:	0f b7 c0             	movzwl %ax,%eax
c0101a97:	0f b7 04 85 c0 9e 10 	movzwl -0x3fef6140(,%eax,4),%eax
c0101a9e:	c0 
c0101a9f:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101aa3:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101aa7:	66 d1 e8             	shr    %ax
c0101aaa:	0f b7 c0             	movzwl %ax,%eax
c0101aad:	0f b7 04 85 c2 9e 10 	movzwl -0x3fef613e(,%eax,4),%eax
c0101ab4:	c0 
c0101ab5:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101ab9:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101abd:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101ac4:	00 
c0101ac5:	89 04 24             	mov    %eax,(%esp)
c0101ac8:	e8 33 fb ff ff       	call   c0101600 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101acd:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101ad1:	83 c0 02             	add    $0x2,%eax
c0101ad4:	0f b7 c0             	movzwl %ax,%eax
c0101ad7:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101adb:	c6 45 ed 00          	movb   $0x0,-0x13(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101adf:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101ae3:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101ae7:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECCNT, nsecs);
c0101ae8:	8b 45 14             	mov    0x14(%ebp),%eax
c0101aeb:	0f b6 c0             	movzbl %al,%eax
c0101aee:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101af2:	83 c2 02             	add    $0x2,%edx
c0101af5:	0f b7 d2             	movzwl %dx,%edx
c0101af8:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101afc:	88 45 e9             	mov    %al,-0x17(%ebp)
c0101aff:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101b03:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101b07:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101b08:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101b0b:	0f b6 c0             	movzbl %al,%eax
c0101b0e:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101b12:	83 c2 03             	add    $0x3,%edx
c0101b15:	0f b7 d2             	movzwl %dx,%edx
c0101b18:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101b1c:	88 45 e5             	mov    %al,-0x1b(%ebp)
c0101b1f:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101b23:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101b27:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101b28:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101b2b:	c1 e8 08             	shr    $0x8,%eax
c0101b2e:	0f b6 c0             	movzbl %al,%eax
c0101b31:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101b35:	83 c2 04             	add    $0x4,%edx
c0101b38:	0f b7 d2             	movzwl %dx,%edx
c0101b3b:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101b3f:	88 45 e1             	mov    %al,-0x1f(%ebp)
c0101b42:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101b46:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101b4a:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101b4b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101b4e:	c1 e8 10             	shr    $0x10,%eax
c0101b51:	0f b6 c0             	movzbl %al,%eax
c0101b54:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101b58:	83 c2 05             	add    $0x5,%edx
c0101b5b:	0f b7 d2             	movzwl %dx,%edx
c0101b5e:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101b62:	88 45 dd             	mov    %al,-0x23(%ebp)
c0101b65:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101b69:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101b6d:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c0101b6e:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101b72:	83 e0 01             	and    $0x1,%eax
c0101b75:	c1 e0 04             	shl    $0x4,%eax
c0101b78:	89 c2                	mov    %eax,%edx
c0101b7a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101b7d:	c1 e8 18             	shr    $0x18,%eax
c0101b80:	83 e0 0f             	and    $0xf,%eax
c0101b83:	09 d0                	or     %edx,%eax
c0101b85:	83 c8 e0             	or     $0xffffffe0,%eax
c0101b88:	0f b6 c0             	movzbl %al,%eax
c0101b8b:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101b8f:	83 c2 06             	add    $0x6,%edx
c0101b92:	0f b7 d2             	movzwl %dx,%edx
c0101b95:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101b99:	88 45 d9             	mov    %al,-0x27(%ebp)
c0101b9c:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101ba0:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101ba4:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);
c0101ba5:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101ba9:	83 c0 07             	add    $0x7,%eax
c0101bac:	0f b7 c0             	movzwl %ax,%eax
c0101baf:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101bb3:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
c0101bb7:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101bbb:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101bbf:	ee                   	out    %al,(%dx)

    int ret = 0;
c0101bc0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101bc7:	eb 5a                	jmp    c0101c23 <ide_read_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101bc9:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101bcd:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101bd4:	00 
c0101bd5:	89 04 24             	mov    %eax,(%esp)
c0101bd8:	e8 23 fa ff ff       	call   c0101600 <ide_wait_ready>
c0101bdd:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101be0:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101be4:	74 02                	je     c0101be8 <ide_read_secs+0x1f7>
            goto out;
c0101be6:	eb 41                	jmp    c0101c29 <ide_read_secs+0x238>
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
c0101be8:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101bec:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101bef:	8b 45 10             	mov    0x10(%ebp),%eax
c0101bf2:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101bf5:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    return data;
}

static inline void
insl(uint32_t port, void *addr, int cnt) {
    asm volatile (
c0101bfc:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101bff:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101c02:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101c05:	89 cb                	mov    %ecx,%ebx
c0101c07:	89 df                	mov    %ebx,%edi
c0101c09:	89 c1                	mov    %eax,%ecx
c0101c0b:	fc                   	cld    
c0101c0c:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0101c0e:	89 c8                	mov    %ecx,%eax
c0101c10:	89 fb                	mov    %edi,%ebx
c0101c12:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101c15:	89 45 c8             	mov    %eax,-0x38(%ebp)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);

    int ret = 0;
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101c18:	83 6d 14 01          	subl   $0x1,0x14(%ebp)
c0101c1c:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101c23:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101c27:	75 a0                	jne    c0101bc9 <ide_read_secs+0x1d8>
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
    }

out:
    return ret;
c0101c29:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101c2c:	83 c4 50             	add    $0x50,%esp
c0101c2f:	5b                   	pop    %ebx
c0101c30:	5f                   	pop    %edi
c0101c31:	5d                   	pop    %ebp
c0101c32:	c3                   	ret    

c0101c33 <ide_write_secs>:

int
ide_write_secs(unsigned short ideno, uint32_t secno, const void *src, size_t nsecs) {
c0101c33:	55                   	push   %ebp
c0101c34:	89 e5                	mov    %esp,%ebp
c0101c36:	56                   	push   %esi
c0101c37:	53                   	push   %ebx
c0101c38:	83 ec 50             	sub    $0x50,%esp
c0101c3b:	8b 45 08             	mov    0x8(%ebp),%eax
c0101c3e:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101c42:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101c49:	77 24                	ja     c0101c6f <ide_write_secs+0x3c>
c0101c4b:	66 83 7d c4 03       	cmpw   $0x3,-0x3c(%ebp)
c0101c50:	77 1d                	ja     c0101c6f <ide_write_secs+0x3c>
c0101c52:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101c56:	c1 e0 03             	shl    $0x3,%eax
c0101c59:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0101c60:	29 c2                	sub    %eax,%edx
c0101c62:	8d 82 20 51 12 c0    	lea    -0x3fedaee0(%edx),%eax
c0101c68:	0f b6 00             	movzbl (%eax),%eax
c0101c6b:	84 c0                	test   %al,%al
c0101c6d:	75 24                	jne    c0101c93 <ide_write_secs+0x60>
c0101c6f:	c7 44 24 0c 50 9f 10 	movl   $0xc0109f50,0xc(%esp)
c0101c76:	c0 
c0101c77:	c7 44 24 08 0b 9f 10 	movl   $0xc0109f0b,0x8(%esp)
c0101c7e:	c0 
c0101c7f:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0101c86:	00 
c0101c87:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c0101c8e:	e8 90 ef ff ff       	call   c0100c23 <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c0101c93:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c0101c9a:	77 0f                	ja     c0101cab <ide_write_secs+0x78>
c0101c9c:	8b 45 14             	mov    0x14(%ebp),%eax
c0101c9f:	8b 55 0c             	mov    0xc(%ebp),%edx
c0101ca2:	01 d0                	add    %edx,%eax
c0101ca4:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c0101ca9:	76 24                	jbe    c0101ccf <ide_write_secs+0x9c>
c0101cab:	c7 44 24 0c 78 9f 10 	movl   $0xc0109f78,0xc(%esp)
c0101cb2:	c0 
c0101cb3:	c7 44 24 08 0b 9f 10 	movl   $0xc0109f0b,0x8(%esp)
c0101cba:	c0 
c0101cbb:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c0101cc2:	00 
c0101cc3:	c7 04 24 20 9f 10 c0 	movl   $0xc0109f20,(%esp)
c0101cca:	e8 54 ef ff ff       	call   c0100c23 <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c0101ccf:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101cd3:	66 d1 e8             	shr    %ax
c0101cd6:	0f b7 c0             	movzwl %ax,%eax
c0101cd9:	0f b7 04 85 c0 9e 10 	movzwl -0x3fef6140(,%eax,4),%eax
c0101ce0:	c0 
c0101ce1:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101ce5:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101ce9:	66 d1 e8             	shr    %ax
c0101cec:	0f b7 c0             	movzwl %ax,%eax
c0101cef:	0f b7 04 85 c2 9e 10 	movzwl -0x3fef613e(,%eax,4),%eax
c0101cf6:	c0 
c0101cf7:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101cfb:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101cff:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101d06:	00 
c0101d07:	89 04 24             	mov    %eax,(%esp)
c0101d0a:	e8 f1 f8 ff ff       	call   c0101600 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101d0f:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c0101d13:	83 c0 02             	add    $0x2,%eax
c0101d16:	0f b7 c0             	movzwl %ax,%eax
c0101d19:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101d1d:	c6 45 ed 00          	movb   $0x0,-0x13(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101d21:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101d25:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101d29:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECCNT, nsecs);
c0101d2a:	8b 45 14             	mov    0x14(%ebp),%eax
c0101d2d:	0f b6 c0             	movzbl %al,%eax
c0101d30:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101d34:	83 c2 02             	add    $0x2,%edx
c0101d37:	0f b7 d2             	movzwl %dx,%edx
c0101d3a:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101d3e:	88 45 e9             	mov    %al,-0x17(%ebp)
c0101d41:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101d45:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101d49:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101d4a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101d4d:	0f b6 c0             	movzbl %al,%eax
c0101d50:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101d54:	83 c2 03             	add    $0x3,%edx
c0101d57:	0f b7 d2             	movzwl %dx,%edx
c0101d5a:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c0101d5e:	88 45 e5             	mov    %al,-0x1b(%ebp)
c0101d61:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101d65:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101d69:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101d6a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101d6d:	c1 e8 08             	shr    $0x8,%eax
c0101d70:	0f b6 c0             	movzbl %al,%eax
c0101d73:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101d77:	83 c2 04             	add    $0x4,%edx
c0101d7a:	0f b7 d2             	movzwl %dx,%edx
c0101d7d:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101d81:	88 45 e1             	mov    %al,-0x1f(%ebp)
c0101d84:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101d88:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101d8c:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101d8d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101d90:	c1 e8 10             	shr    $0x10,%eax
c0101d93:	0f b6 c0             	movzbl %al,%eax
c0101d96:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101d9a:	83 c2 05             	add    $0x5,%edx
c0101d9d:	0f b7 d2             	movzwl %dx,%edx
c0101da0:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101da4:	88 45 dd             	mov    %al,-0x23(%ebp)
c0101da7:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101dab:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101daf:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c0101db0:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101db4:	83 e0 01             	and    $0x1,%eax
c0101db7:	c1 e0 04             	shl    $0x4,%eax
c0101dba:	89 c2                	mov    %eax,%edx
c0101dbc:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101dbf:	c1 e8 18             	shr    $0x18,%eax
c0101dc2:	83 e0 0f             	and    $0xf,%eax
c0101dc5:	09 d0                	or     %edx,%eax
c0101dc7:	83 c8 e0             	or     $0xffffffe0,%eax
c0101dca:	0f b6 c0             	movzbl %al,%eax
c0101dcd:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101dd1:	83 c2 06             	add    $0x6,%edx
c0101dd4:	0f b7 d2             	movzwl %dx,%edx
c0101dd7:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101ddb:	88 45 d9             	mov    %al,-0x27(%ebp)
c0101dde:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101de2:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101de6:	ee                   	out    %al,(%dx)
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);
c0101de7:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101deb:	83 c0 07             	add    $0x7,%eax
c0101dee:	0f b7 c0             	movzwl %ax,%eax
c0101df1:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101df5:	c6 45 d5 30          	movb   $0x30,-0x2b(%ebp)
c0101df9:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101dfd:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101e01:	ee                   	out    %al,(%dx)

    int ret = 0;
c0101e02:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c0101e09:	eb 5a                	jmp    c0101e65 <ide_write_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101e0b:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101e0f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101e16:	00 
c0101e17:	89 04 24             	mov    %eax,(%esp)
c0101e1a:	e8 e1 f7 ff ff       	call   c0101600 <ide_wait_ready>
c0101e1f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101e22:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101e26:	74 02                	je     c0101e2a <ide_write_secs+0x1f7>
            goto out;
c0101e28:	eb 41                	jmp    c0101e6b <ide_write_secs+0x238>
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
c0101e2a:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101e2e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101e31:	8b 45 10             	mov    0x10(%ebp),%eax
c0101e34:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101e37:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile ("outw %0, %1" :: "a" (data), "d" (port) : "memory");
}

static inline void
outsl(uint32_t port, const void *addr, int cnt) {
    asm volatile (
c0101e3e:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101e41:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101e44:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101e47:	89 cb                	mov    %ecx,%ebx
c0101e49:	89 de                	mov    %ebx,%esi
c0101e4b:	89 c1                	mov    %eax,%ecx
c0101e4d:	fc                   	cld    
c0101e4e:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
c0101e50:	89 c8                	mov    %ecx,%eax
c0101e52:	89 f3                	mov    %esi,%ebx
c0101e54:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c0101e57:	89 45 c8             	mov    %eax,-0x38(%ebp)
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);

    int ret = 0;
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c0101e5a:	83 6d 14 01          	subl   $0x1,0x14(%ebp)
c0101e5e:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c0101e65:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c0101e69:	75 a0                	jne    c0101e0b <ide_write_secs+0x1d8>
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
    }

out:
    return ret;
c0101e6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101e6e:	83 c4 50             	add    $0x50,%esp
c0101e71:	5b                   	pop    %ebx
c0101e72:	5e                   	pop    %esi
c0101e73:	5d                   	pop    %ebp
c0101e74:	c3                   	ret    

c0101e75 <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c0101e75:	55                   	push   %ebp
c0101e76:	89 e5                	mov    %esp,%ebp
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
}

static inline void
sti(void) {
    asm volatile ("sti");
c0101e78:	fb                   	sti    
    sti();
}
c0101e79:	5d                   	pop    %ebp
c0101e7a:	c3                   	ret    

c0101e7b <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c0101e7b:	55                   	push   %ebp
c0101e7c:	89 e5                	mov    %esp,%ebp
}

static inline void
cli(void) {
    asm volatile ("cli" ::: "memory");
c0101e7e:	fa                   	cli    
    cli();
}
c0101e7f:	5d                   	pop    %ebp
c0101e80:	c3                   	ret    

c0101e81 <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c0101e81:	55                   	push   %ebp
c0101e82:	89 e5                	mov    %esp,%ebp
c0101e84:	83 ec 14             	sub    $0x14,%esp
c0101e87:	8b 45 08             	mov    0x8(%ebp),%eax
c0101e8a:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c0101e8e:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101e92:	66 a3 70 45 12 c0    	mov    %ax,0xc0124570
    if (did_init) {
c0101e98:	a1 00 52 12 c0       	mov    0xc0125200,%eax
c0101e9d:	85 c0                	test   %eax,%eax
c0101e9f:	74 36                	je     c0101ed7 <pic_setmask+0x56>
        outb(IO_PIC1 + 1, mask);
c0101ea1:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101ea5:	0f b6 c0             	movzbl %al,%eax
c0101ea8:	66 c7 45 fe 21 00    	movw   $0x21,-0x2(%ebp)
c0101eae:	88 45 fd             	mov    %al,-0x3(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101eb1:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0101eb5:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0101eb9:	ee                   	out    %al,(%dx)
        outb(IO_PIC2 + 1, mask >> 8);
c0101eba:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101ebe:	66 c1 e8 08          	shr    $0x8,%ax
c0101ec2:	0f b6 c0             	movzbl %al,%eax
c0101ec5:	66 c7 45 fa a1 00    	movw   $0xa1,-0x6(%ebp)
c0101ecb:	88 45 f9             	mov    %al,-0x7(%ebp)
c0101ece:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101ed2:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101ed6:	ee                   	out    %al,(%dx)
    }
}
c0101ed7:	c9                   	leave  
c0101ed8:	c3                   	ret    

c0101ed9 <pic_enable>:

void
pic_enable(unsigned int irq) {
c0101ed9:	55                   	push   %ebp
c0101eda:	89 e5                	mov    %esp,%ebp
c0101edc:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c0101edf:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ee2:	ba 01 00 00 00       	mov    $0x1,%edx
c0101ee7:	89 c1                	mov    %eax,%ecx
c0101ee9:	d3 e2                	shl    %cl,%edx
c0101eeb:	89 d0                	mov    %edx,%eax
c0101eed:	f7 d0                	not    %eax
c0101eef:	89 c2                	mov    %eax,%edx
c0101ef1:	0f b7 05 70 45 12 c0 	movzwl 0xc0124570,%eax
c0101ef8:	21 d0                	and    %edx,%eax
c0101efa:	0f b7 c0             	movzwl %ax,%eax
c0101efd:	89 04 24             	mov    %eax,(%esp)
c0101f00:	e8 7c ff ff ff       	call   c0101e81 <pic_setmask>
}
c0101f05:	c9                   	leave  
c0101f06:	c3                   	ret    

c0101f07 <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c0101f07:	55                   	push   %ebp
c0101f08:	89 e5                	mov    %esp,%ebp
c0101f0a:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c0101f0d:	c7 05 00 52 12 c0 01 	movl   $0x1,0xc0125200
c0101f14:	00 00 00 
c0101f17:	66 c7 45 fe 21 00    	movw   $0x21,-0x2(%ebp)
c0101f1d:	c6 45 fd ff          	movb   $0xff,-0x3(%ebp)
c0101f21:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0101f25:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0101f29:	ee                   	out    %al,(%dx)
c0101f2a:	66 c7 45 fa a1 00    	movw   $0xa1,-0x6(%ebp)
c0101f30:	c6 45 f9 ff          	movb   $0xff,-0x7(%ebp)
c0101f34:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101f38:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101f3c:	ee                   	out    %al,(%dx)
c0101f3d:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c0101f43:	c6 45 f5 11          	movb   $0x11,-0xb(%ebp)
c0101f47:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101f4b:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101f4f:	ee                   	out    %al,(%dx)
c0101f50:	66 c7 45 f2 21 00    	movw   $0x21,-0xe(%ebp)
c0101f56:	c6 45 f1 20          	movb   $0x20,-0xf(%ebp)
c0101f5a:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101f5e:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101f62:	ee                   	out    %al,(%dx)
c0101f63:	66 c7 45 ee 21 00    	movw   $0x21,-0x12(%ebp)
c0101f69:	c6 45 ed 04          	movb   $0x4,-0x13(%ebp)
c0101f6d:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101f71:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101f75:	ee                   	out    %al,(%dx)
c0101f76:	66 c7 45 ea 21 00    	movw   $0x21,-0x16(%ebp)
c0101f7c:	c6 45 e9 03          	movb   $0x3,-0x17(%ebp)
c0101f80:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101f84:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101f88:	ee                   	out    %al,(%dx)
c0101f89:	66 c7 45 e6 a0 00    	movw   $0xa0,-0x1a(%ebp)
c0101f8f:	c6 45 e5 11          	movb   $0x11,-0x1b(%ebp)
c0101f93:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101f97:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101f9b:	ee                   	out    %al,(%dx)
c0101f9c:	66 c7 45 e2 a1 00    	movw   $0xa1,-0x1e(%ebp)
c0101fa2:	c6 45 e1 28          	movb   $0x28,-0x1f(%ebp)
c0101fa6:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0101faa:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101fae:	ee                   	out    %al,(%dx)
c0101faf:	66 c7 45 de a1 00    	movw   $0xa1,-0x22(%ebp)
c0101fb5:	c6 45 dd 02          	movb   $0x2,-0x23(%ebp)
c0101fb9:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c0101fbd:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0101fc1:	ee                   	out    %al,(%dx)
c0101fc2:	66 c7 45 da a1 00    	movw   $0xa1,-0x26(%ebp)
c0101fc8:	c6 45 d9 03          	movb   $0x3,-0x27(%ebp)
c0101fcc:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0101fd0:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101fd4:	ee                   	out    %al,(%dx)
c0101fd5:	66 c7 45 d6 20 00    	movw   $0x20,-0x2a(%ebp)
c0101fdb:	c6 45 d5 68          	movb   $0x68,-0x2b(%ebp)
c0101fdf:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101fe3:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101fe7:	ee                   	out    %al,(%dx)
c0101fe8:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c0101fee:	c6 45 d1 0a          	movb   $0xa,-0x2f(%ebp)
c0101ff2:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0101ff6:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c0101ffa:	ee                   	out    %al,(%dx)
c0101ffb:	66 c7 45 ce a0 00    	movw   $0xa0,-0x32(%ebp)
c0102001:	c6 45 cd 68          	movb   $0x68,-0x33(%ebp)
c0102005:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0102009:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c010200d:	ee                   	out    %al,(%dx)
c010200e:	66 c7 45 ca a0 00    	movw   $0xa0,-0x36(%ebp)
c0102014:	c6 45 c9 0a          	movb   $0xa,-0x37(%ebp)
c0102018:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c010201c:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c0102020:	ee                   	out    %al,(%dx)
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c0102021:	0f b7 05 70 45 12 c0 	movzwl 0xc0124570,%eax
c0102028:	66 83 f8 ff          	cmp    $0xffff,%ax
c010202c:	74 12                	je     c0102040 <pic_init+0x139>
        pic_setmask(irq_mask);
c010202e:	0f b7 05 70 45 12 c0 	movzwl 0xc0124570,%eax
c0102035:	0f b7 c0             	movzwl %ax,%eax
c0102038:	89 04 24             	mov    %eax,(%esp)
c010203b:	e8 41 fe ff ff       	call   c0101e81 <pic_setmask>
    }
}
c0102040:	c9                   	leave  
c0102041:	c3                   	ret    

c0102042 <print_ticks>:
#include <swap.h>
#include <kdebug.h>

#define TICK_NUM 100

static void print_ticks() {
c0102042:	55                   	push   %ebp
c0102043:	89 e5                	mov    %esp,%ebp
c0102045:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c0102048:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c010204f:	00 
c0102050:	c7 04 24 c0 9f 10 c0 	movl   $0xc0109fc0,(%esp)
c0102057:	e8 f7 e2 ff ff       	call   c0100353 <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
    panic("EOT: kernel seems ok.");
#endif
}
c010205c:	c9                   	leave  
c010205d:	c3                   	ret    

c010205e <idt_init>:
    sizeof(idt) - 1, (uintptr_t)idt
};

/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
c010205e:	55                   	push   %ebp
c010205f:	89 e5                	mov    %esp,%ebp
c0102061:	83 ec 10             	sub    $0x10,%esp
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c0102064:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c010206b:	e9 c3 00 00 00       	jmp    c0102133 <idt_init+0xd5>
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
c0102070:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102073:	8b 04 85 00 46 12 c0 	mov    -0x3fedba00(,%eax,4),%eax
c010207a:	89 c2                	mov    %eax,%edx
c010207c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010207f:	66 89 14 c5 20 52 12 	mov    %dx,-0x3fedade0(,%eax,8)
c0102086:	c0 
c0102087:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010208a:	66 c7 04 c5 22 52 12 	movw   $0x8,-0x3fedadde(,%eax,8)
c0102091:	c0 08 00 
c0102094:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102097:	0f b6 14 c5 24 52 12 	movzbl -0x3fedaddc(,%eax,8),%edx
c010209e:	c0 
c010209f:	83 e2 e0             	and    $0xffffffe0,%edx
c01020a2:	88 14 c5 24 52 12 c0 	mov    %dl,-0x3fedaddc(,%eax,8)
c01020a9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01020ac:	0f b6 14 c5 24 52 12 	movzbl -0x3fedaddc(,%eax,8),%edx
c01020b3:	c0 
c01020b4:	83 e2 1f             	and    $0x1f,%edx
c01020b7:	88 14 c5 24 52 12 c0 	mov    %dl,-0x3fedaddc(,%eax,8)
c01020be:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01020c1:	0f b6 14 c5 25 52 12 	movzbl -0x3fedaddb(,%eax,8),%edx
c01020c8:	c0 
c01020c9:	83 e2 f0             	and    $0xfffffff0,%edx
c01020cc:	83 ca 0e             	or     $0xe,%edx
c01020cf:	88 14 c5 25 52 12 c0 	mov    %dl,-0x3fedaddb(,%eax,8)
c01020d6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01020d9:	0f b6 14 c5 25 52 12 	movzbl -0x3fedaddb(,%eax,8),%edx
c01020e0:	c0 
c01020e1:	83 e2 ef             	and    $0xffffffef,%edx
c01020e4:	88 14 c5 25 52 12 c0 	mov    %dl,-0x3fedaddb(,%eax,8)
c01020eb:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01020ee:	0f b6 14 c5 25 52 12 	movzbl -0x3fedaddb(,%eax,8),%edx
c01020f5:	c0 
c01020f6:	83 e2 9f             	and    $0xffffff9f,%edx
c01020f9:	88 14 c5 25 52 12 c0 	mov    %dl,-0x3fedaddb(,%eax,8)
c0102100:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102103:	0f b6 14 c5 25 52 12 	movzbl -0x3fedaddb(,%eax,8),%edx
c010210a:	c0 
c010210b:	83 ca 80             	or     $0xffffff80,%edx
c010210e:	88 14 c5 25 52 12 c0 	mov    %dl,-0x3fedaddb(,%eax,8)
c0102115:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102118:	8b 04 85 00 46 12 c0 	mov    -0x3fedba00(,%eax,4),%eax
c010211f:	c1 e8 10             	shr    $0x10,%eax
c0102122:	89 c2                	mov    %eax,%edx
c0102124:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102127:	66 89 14 c5 26 52 12 	mov    %dx,-0x3fedadda(,%eax,8)
c010212e:	c0 
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c010212f:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c0102133:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102136:	3d ff 00 00 00       	cmp    $0xff,%eax
c010213b:	0f 86 2f ff ff ff    	jbe    c0102070 <idt_init+0x12>
c0102141:	c7 45 f8 80 45 12 c0 	movl   $0xc0124580,-0x8(%ebp)
    }
}

static inline void
lidt(struct pseudodesc *pd) {
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
c0102148:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010214b:	0f 01 18             	lidtl  (%eax)
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
    }
    lidt(&idt_pd);
}
c010214e:	c9                   	leave  
c010214f:	c3                   	ret    

c0102150 <trapname>:

static const char *
trapname(int trapno) {
c0102150:	55                   	push   %ebp
c0102151:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c0102153:	8b 45 08             	mov    0x8(%ebp),%eax
c0102156:	83 f8 13             	cmp    $0x13,%eax
c0102159:	77 0c                	ja     c0102167 <trapname+0x17>
        return excnames[trapno];
c010215b:	8b 45 08             	mov    0x8(%ebp),%eax
c010215e:	8b 04 85 a0 a3 10 c0 	mov    -0x3fef5c60(,%eax,4),%eax
c0102165:	eb 18                	jmp    c010217f <trapname+0x2f>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c0102167:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c010216b:	7e 0d                	jle    c010217a <trapname+0x2a>
c010216d:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c0102171:	7f 07                	jg     c010217a <trapname+0x2a>
        return "Hardware Interrupt";
c0102173:	b8 ca 9f 10 c0       	mov    $0xc0109fca,%eax
c0102178:	eb 05                	jmp    c010217f <trapname+0x2f>
    }
    return "(unknown trap)";
c010217a:	b8 dd 9f 10 c0       	mov    $0xc0109fdd,%eax
}
c010217f:	5d                   	pop    %ebp
c0102180:	c3                   	ret    

c0102181 <trap_in_kernel>:

/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
c0102181:	55                   	push   %ebp
c0102182:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c0102184:	8b 45 08             	mov    0x8(%ebp),%eax
c0102187:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c010218b:	66 83 f8 08          	cmp    $0x8,%ax
c010218f:	0f 94 c0             	sete   %al
c0102192:	0f b6 c0             	movzbl %al,%eax
}
c0102195:	5d                   	pop    %ebp
c0102196:	c3                   	ret    

c0102197 <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c0102197:	55                   	push   %ebp
c0102198:	89 e5                	mov    %esp,%ebp
c010219a:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c010219d:	8b 45 08             	mov    0x8(%ebp),%eax
c01021a0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01021a4:	c7 04 24 1e a0 10 c0 	movl   $0xc010a01e,(%esp)
c01021ab:	e8 a3 e1 ff ff       	call   c0100353 <cprintf>
    print_regs(&tf->tf_regs);
c01021b0:	8b 45 08             	mov    0x8(%ebp),%eax
c01021b3:	89 04 24             	mov    %eax,(%esp)
c01021b6:	e8 a1 01 00 00       	call   c010235c <print_regs>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c01021bb:	8b 45 08             	mov    0x8(%ebp),%eax
c01021be:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c01021c2:	0f b7 c0             	movzwl %ax,%eax
c01021c5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01021c9:	c7 04 24 2f a0 10 c0 	movl   $0xc010a02f,(%esp)
c01021d0:	e8 7e e1 ff ff       	call   c0100353 <cprintf>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c01021d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01021d8:	0f b7 40 28          	movzwl 0x28(%eax),%eax
c01021dc:	0f b7 c0             	movzwl %ax,%eax
c01021df:	89 44 24 04          	mov    %eax,0x4(%esp)
c01021e3:	c7 04 24 42 a0 10 c0 	movl   $0xc010a042,(%esp)
c01021ea:	e8 64 e1 ff ff       	call   c0100353 <cprintf>
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
c01021ef:	8b 45 08             	mov    0x8(%ebp),%eax
c01021f2:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c01021f6:	0f b7 c0             	movzwl %ax,%eax
c01021f9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01021fd:	c7 04 24 55 a0 10 c0 	movl   $0xc010a055,(%esp)
c0102204:	e8 4a e1 ff ff       	call   c0100353 <cprintf>
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
c0102209:	8b 45 08             	mov    0x8(%ebp),%eax
c010220c:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c0102210:	0f b7 c0             	movzwl %ax,%eax
c0102213:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102217:	c7 04 24 68 a0 10 c0 	movl   $0xc010a068,(%esp)
c010221e:	e8 30 e1 ff ff       	call   c0100353 <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c0102223:	8b 45 08             	mov    0x8(%ebp),%eax
c0102226:	8b 40 30             	mov    0x30(%eax),%eax
c0102229:	89 04 24             	mov    %eax,(%esp)
c010222c:	e8 1f ff ff ff       	call   c0102150 <trapname>
c0102231:	8b 55 08             	mov    0x8(%ebp),%edx
c0102234:	8b 52 30             	mov    0x30(%edx),%edx
c0102237:	89 44 24 08          	mov    %eax,0x8(%esp)
c010223b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010223f:	c7 04 24 7b a0 10 c0 	movl   $0xc010a07b,(%esp)
c0102246:	e8 08 e1 ff ff       	call   c0100353 <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c010224b:	8b 45 08             	mov    0x8(%ebp),%eax
c010224e:	8b 40 34             	mov    0x34(%eax),%eax
c0102251:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102255:	c7 04 24 8d a0 10 c0 	movl   $0xc010a08d,(%esp)
c010225c:	e8 f2 e0 ff ff       	call   c0100353 <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c0102261:	8b 45 08             	mov    0x8(%ebp),%eax
c0102264:	8b 40 38             	mov    0x38(%eax),%eax
c0102267:	89 44 24 04          	mov    %eax,0x4(%esp)
c010226b:	c7 04 24 9c a0 10 c0 	movl   $0xc010a09c,(%esp)
c0102272:	e8 dc e0 ff ff       	call   c0100353 <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c0102277:	8b 45 08             	mov    0x8(%ebp),%eax
c010227a:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c010227e:	0f b7 c0             	movzwl %ax,%eax
c0102281:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102285:	c7 04 24 ab a0 10 c0 	movl   $0xc010a0ab,(%esp)
c010228c:	e8 c2 e0 ff ff       	call   c0100353 <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c0102291:	8b 45 08             	mov    0x8(%ebp),%eax
c0102294:	8b 40 40             	mov    0x40(%eax),%eax
c0102297:	89 44 24 04          	mov    %eax,0x4(%esp)
c010229b:	c7 04 24 be a0 10 c0 	movl   $0xc010a0be,(%esp)
c01022a2:	e8 ac e0 ff ff       	call   c0100353 <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01022a7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01022ae:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
c01022b5:	eb 3e                	jmp    c01022f5 <print_trapframe+0x15e>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c01022b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01022ba:	8b 50 40             	mov    0x40(%eax),%edx
c01022bd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01022c0:	21 d0                	and    %edx,%eax
c01022c2:	85 c0                	test   %eax,%eax
c01022c4:	74 28                	je     c01022ee <print_trapframe+0x157>
c01022c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01022c9:	8b 04 85 a0 45 12 c0 	mov    -0x3fedba60(,%eax,4),%eax
c01022d0:	85 c0                	test   %eax,%eax
c01022d2:	74 1a                	je     c01022ee <print_trapframe+0x157>
            cprintf("%s,", IA32flags[i]);
c01022d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01022d7:	8b 04 85 a0 45 12 c0 	mov    -0x3fedba60(,%eax,4),%eax
c01022de:	89 44 24 04          	mov    %eax,0x4(%esp)
c01022e2:	c7 04 24 cd a0 10 c0 	movl   $0xc010a0cd,(%esp)
c01022e9:	e8 65 e0 ff ff       	call   c0100353 <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
    cprintf("  flag 0x%08x ", tf->tf_eflags);

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01022ee:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c01022f2:	d1 65 f0             	shll   -0x10(%ebp)
c01022f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01022f8:	83 f8 17             	cmp    $0x17,%eax
c01022fb:	76 ba                	jbe    c01022b7 <print_trapframe+0x120>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
            cprintf("%s,", IA32flags[i]);
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c01022fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0102300:	8b 40 40             	mov    0x40(%eax),%eax
c0102303:	25 00 30 00 00       	and    $0x3000,%eax
c0102308:	c1 e8 0c             	shr    $0xc,%eax
c010230b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010230f:	c7 04 24 d1 a0 10 c0 	movl   $0xc010a0d1,(%esp)
c0102316:	e8 38 e0 ff ff       	call   c0100353 <cprintf>

    if (!trap_in_kernel(tf)) {
c010231b:	8b 45 08             	mov    0x8(%ebp),%eax
c010231e:	89 04 24             	mov    %eax,(%esp)
c0102321:	e8 5b fe ff ff       	call   c0102181 <trap_in_kernel>
c0102326:	85 c0                	test   %eax,%eax
c0102328:	75 30                	jne    c010235a <print_trapframe+0x1c3>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c010232a:	8b 45 08             	mov    0x8(%ebp),%eax
c010232d:	8b 40 44             	mov    0x44(%eax),%eax
c0102330:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102334:	c7 04 24 da a0 10 c0 	movl   $0xc010a0da,(%esp)
c010233b:	e8 13 e0 ff ff       	call   c0100353 <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c0102340:	8b 45 08             	mov    0x8(%ebp),%eax
c0102343:	0f b7 40 48          	movzwl 0x48(%eax),%eax
c0102347:	0f b7 c0             	movzwl %ax,%eax
c010234a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010234e:	c7 04 24 e9 a0 10 c0 	movl   $0xc010a0e9,(%esp)
c0102355:	e8 f9 df ff ff       	call   c0100353 <cprintf>
    }
}
c010235a:	c9                   	leave  
c010235b:	c3                   	ret    

c010235c <print_regs>:

void
print_regs(struct pushregs *regs) {
c010235c:	55                   	push   %ebp
c010235d:	89 e5                	mov    %esp,%ebp
c010235f:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c0102362:	8b 45 08             	mov    0x8(%ebp),%eax
c0102365:	8b 00                	mov    (%eax),%eax
c0102367:	89 44 24 04          	mov    %eax,0x4(%esp)
c010236b:	c7 04 24 fc a0 10 c0 	movl   $0xc010a0fc,(%esp)
c0102372:	e8 dc df ff ff       	call   c0100353 <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c0102377:	8b 45 08             	mov    0x8(%ebp),%eax
c010237a:	8b 40 04             	mov    0x4(%eax),%eax
c010237d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102381:	c7 04 24 0b a1 10 c0 	movl   $0xc010a10b,(%esp)
c0102388:	e8 c6 df ff ff       	call   c0100353 <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c010238d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102390:	8b 40 08             	mov    0x8(%eax),%eax
c0102393:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102397:	c7 04 24 1a a1 10 c0 	movl   $0xc010a11a,(%esp)
c010239e:	e8 b0 df ff ff       	call   c0100353 <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c01023a3:	8b 45 08             	mov    0x8(%ebp),%eax
c01023a6:	8b 40 0c             	mov    0xc(%eax),%eax
c01023a9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023ad:	c7 04 24 29 a1 10 c0 	movl   $0xc010a129,(%esp)
c01023b4:	e8 9a df ff ff       	call   c0100353 <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c01023b9:	8b 45 08             	mov    0x8(%ebp),%eax
c01023bc:	8b 40 10             	mov    0x10(%eax),%eax
c01023bf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023c3:	c7 04 24 38 a1 10 c0 	movl   $0xc010a138,(%esp)
c01023ca:	e8 84 df ff ff       	call   c0100353 <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c01023cf:	8b 45 08             	mov    0x8(%ebp),%eax
c01023d2:	8b 40 14             	mov    0x14(%eax),%eax
c01023d5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023d9:	c7 04 24 47 a1 10 c0 	movl   $0xc010a147,(%esp)
c01023e0:	e8 6e df ff ff       	call   c0100353 <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c01023e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01023e8:	8b 40 18             	mov    0x18(%eax),%eax
c01023eb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023ef:	c7 04 24 56 a1 10 c0 	movl   $0xc010a156,(%esp)
c01023f6:	e8 58 df ff ff       	call   c0100353 <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c01023fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01023fe:	8b 40 1c             	mov    0x1c(%eax),%eax
c0102401:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102405:	c7 04 24 65 a1 10 c0 	movl   $0xc010a165,(%esp)
c010240c:	e8 42 df ff ff       	call   c0100353 <cprintf>
}
c0102411:	c9                   	leave  
c0102412:	c3                   	ret    

c0102413 <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c0102413:	55                   	push   %ebp
c0102414:	89 e5                	mov    %esp,%ebp
c0102416:	53                   	push   %ebx
c0102417:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c010241a:	8b 45 08             	mov    0x8(%ebp),%eax
c010241d:	8b 40 34             	mov    0x34(%eax),%eax
c0102420:	83 e0 01             	and    $0x1,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102423:	85 c0                	test   %eax,%eax
c0102425:	74 07                	je     c010242e <print_pgfault+0x1b>
c0102427:	b9 74 a1 10 c0       	mov    $0xc010a174,%ecx
c010242c:	eb 05                	jmp    c0102433 <print_pgfault+0x20>
c010242e:	b9 85 a1 10 c0       	mov    $0xc010a185,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
c0102433:	8b 45 08             	mov    0x8(%ebp),%eax
c0102436:	8b 40 34             	mov    0x34(%eax),%eax
c0102439:	83 e0 02             	and    $0x2,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c010243c:	85 c0                	test   %eax,%eax
c010243e:	74 07                	je     c0102447 <print_pgfault+0x34>
c0102440:	ba 57 00 00 00       	mov    $0x57,%edx
c0102445:	eb 05                	jmp    c010244c <print_pgfault+0x39>
c0102447:	ba 52 00 00 00       	mov    $0x52,%edx
            (tf->tf_err & 4) ? 'U' : 'K',
c010244c:	8b 45 08             	mov    0x8(%ebp),%eax
c010244f:	8b 40 34             	mov    0x34(%eax),%eax
c0102452:	83 e0 04             	and    $0x4,%eax
    /* error_code:
     * bit 0 == 0 means no page found, 1 means protection fault
     * bit 1 == 0 means read, 1 means write
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102455:	85 c0                	test   %eax,%eax
c0102457:	74 07                	je     c0102460 <print_pgfault+0x4d>
c0102459:	b8 55 00 00 00       	mov    $0x55,%eax
c010245e:	eb 05                	jmp    c0102465 <print_pgfault+0x52>
c0102460:	b8 4b 00 00 00       	mov    $0x4b,%eax
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c0102465:	0f 20 d3             	mov    %cr2,%ebx
c0102468:	89 5d f4             	mov    %ebx,-0xc(%ebp)
    return cr2;
c010246b:	8b 5d f4             	mov    -0xc(%ebp),%ebx
c010246e:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0102472:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0102476:	89 44 24 08          	mov    %eax,0x8(%esp)
c010247a:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c010247e:	c7 04 24 94 a1 10 c0 	movl   $0xc010a194,(%esp)
c0102485:	e8 c9 de ff ff       	call   c0100353 <cprintf>
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
}
c010248a:	83 c4 34             	add    $0x34,%esp
c010248d:	5b                   	pop    %ebx
c010248e:	5d                   	pop    %ebp
c010248f:	c3                   	ret    

c0102490 <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c0102490:	55                   	push   %ebp
c0102491:	89 e5                	mov    %esp,%ebp
c0102493:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
c0102496:	8b 45 08             	mov    0x8(%ebp),%eax
c0102499:	89 04 24             	mov    %eax,(%esp)
c010249c:	e8 72 ff ff ff       	call   c0102413 <print_pgfault>
    if (check_mm_struct != NULL) {
c01024a1:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c01024a6:	85 c0                	test   %eax,%eax
c01024a8:	74 28                	je     c01024d2 <pgfault_handler+0x42>
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01024aa:	0f 20 d0             	mov    %cr2,%eax
c01024ad:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01024b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
c01024b3:	89 c1                	mov    %eax,%ecx
c01024b5:	8b 45 08             	mov    0x8(%ebp),%eax
c01024b8:	8b 50 34             	mov    0x34(%eax),%edx
c01024bb:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c01024c0:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01024c4:	89 54 24 04          	mov    %edx,0x4(%esp)
c01024c8:	89 04 24             	mov    %eax,(%esp)
c01024cb:	e8 dd 5b 00 00       	call   c01080ad <do_pgfault>
c01024d0:	eb 1c                	jmp    c01024ee <pgfault_handler+0x5e>
    }
    panic("unhandled page fault.\n");
c01024d2:	c7 44 24 08 b7 a1 10 	movl   $0xc010a1b7,0x8(%esp)
c01024d9:	c0 
c01024da:	c7 44 24 04 a5 00 00 	movl   $0xa5,0x4(%esp)
c01024e1:	00 
c01024e2:	c7 04 24 ce a1 10 c0 	movl   $0xc010a1ce,(%esp)
c01024e9:	e8 35 e7 ff ff       	call   c0100c23 <__panic>
}
c01024ee:	c9                   	leave  
c01024ef:	c3                   	ret    

c01024f0 <trap_dispatch>:

static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;

static void
trap_dispatch(struct trapframe *tf) {
c01024f0:	55                   	push   %ebp
c01024f1:	89 e5                	mov    %esp,%ebp
c01024f3:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret;

    switch (tf->tf_trapno) {
c01024f6:	8b 45 08             	mov    0x8(%ebp),%eax
c01024f9:	8b 40 30             	mov    0x30(%eax),%eax
c01024fc:	83 f8 24             	cmp    $0x24,%eax
c01024ff:	0f 84 c2 00 00 00    	je     c01025c7 <trap_dispatch+0xd7>
c0102505:	83 f8 24             	cmp    $0x24,%eax
c0102508:	77 18                	ja     c0102522 <trap_dispatch+0x32>
c010250a:	83 f8 20             	cmp    $0x20,%eax
c010250d:	74 7d                	je     c010258c <trap_dispatch+0x9c>
c010250f:	83 f8 21             	cmp    $0x21,%eax
c0102512:	0f 84 d5 00 00 00    	je     c01025ed <trap_dispatch+0xfd>
c0102518:	83 f8 0e             	cmp    $0xe,%eax
c010251b:	74 28                	je     c0102545 <trap_dispatch+0x55>
c010251d:	e9 0d 01 00 00       	jmp    c010262f <trap_dispatch+0x13f>
c0102522:	83 f8 2e             	cmp    $0x2e,%eax
c0102525:	0f 82 04 01 00 00    	jb     c010262f <trap_dispatch+0x13f>
c010252b:	83 f8 2f             	cmp    $0x2f,%eax
c010252e:	0f 86 33 01 00 00    	jbe    c0102667 <trap_dispatch+0x177>
c0102534:	83 e8 78             	sub    $0x78,%eax
c0102537:	83 f8 01             	cmp    $0x1,%eax
c010253a:	0f 87 ef 00 00 00    	ja     c010262f <trap_dispatch+0x13f>
c0102540:	e9 ce 00 00 00       	jmp    c0102613 <trap_dispatch+0x123>
    case T_PGFLT:  //page fault
        if ((ret = pgfault_handler(tf)) != 0) {
c0102545:	8b 45 08             	mov    0x8(%ebp),%eax
c0102548:	89 04 24             	mov    %eax,(%esp)
c010254b:	e8 40 ff ff ff       	call   c0102490 <pgfault_handler>
c0102550:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0102553:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0102557:	74 2e                	je     c0102587 <trap_dispatch+0x97>
            print_trapframe(tf);
c0102559:	8b 45 08             	mov    0x8(%ebp),%eax
c010255c:	89 04 24             	mov    %eax,(%esp)
c010255f:	e8 33 fc ff ff       	call   c0102197 <print_trapframe>
            panic("handle pgfault failed. %e\n", ret);
c0102564:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0102567:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010256b:	c7 44 24 08 df a1 10 	movl   $0xc010a1df,0x8(%esp)
c0102572:	c0 
c0102573:	c7 44 24 04 b5 00 00 	movl   $0xb5,0x4(%esp)
c010257a:	00 
c010257b:	c7 04 24 ce a1 10 c0 	movl   $0xc010a1ce,(%esp)
c0102582:	e8 9c e6 ff ff       	call   c0100c23 <__panic>
        }
        break;
c0102587:	e9 dc 00 00 00       	jmp    c0102668 <trap_dispatch+0x178>
        /* handle the timer interrupt */
        /* (1) After a timer interrupt, you should record this event using a global variable (increase it), such as ticks in kern/driver/clock.c
         * (2) Every TICK_NUM cycle, you can print some info using a funciton, such as print_ticks().
         * (3) Too Simple? Yes, I think so!
         */
        ticks ++;
c010258c:	a1 14 7b 12 c0       	mov    0xc0127b14,%eax
c0102591:	83 c0 01             	add    $0x1,%eax
c0102594:	a3 14 7b 12 c0       	mov    %eax,0xc0127b14
        if (ticks % TICK_NUM == 0) {
c0102599:	8b 0d 14 7b 12 c0    	mov    0xc0127b14,%ecx
c010259f:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c01025a4:	89 c8                	mov    %ecx,%eax
c01025a6:	f7 e2                	mul    %edx
c01025a8:	89 d0                	mov    %edx,%eax
c01025aa:	c1 e8 05             	shr    $0x5,%eax
c01025ad:	6b c0 64             	imul   $0x64,%eax,%eax
c01025b0:	29 c1                	sub    %eax,%ecx
c01025b2:	89 c8                	mov    %ecx,%eax
c01025b4:	85 c0                	test   %eax,%eax
c01025b6:	75 0a                	jne    c01025c2 <trap_dispatch+0xd2>
            print_ticks();
c01025b8:	e8 85 fa ff ff       	call   c0102042 <print_ticks>
        }
        break;
c01025bd:	e9 a6 00 00 00       	jmp    c0102668 <trap_dispatch+0x178>
c01025c2:	e9 a1 00 00 00       	jmp    c0102668 <trap_dispatch+0x178>
    case IRQ_OFFSET + IRQ_COM1:
        c = cons_getc();
c01025c7:	e8 c5 ef ff ff       	call   c0101591 <cons_getc>
c01025cc:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("serial [%03d] %c\n", c, c);
c01025cf:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c01025d3:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c01025d7:	89 54 24 08          	mov    %edx,0x8(%esp)
c01025db:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025df:	c7 04 24 fa a1 10 c0 	movl   $0xc010a1fa,(%esp)
c01025e6:	e8 68 dd ff ff       	call   c0100353 <cprintf>
        break;
c01025eb:	eb 7b                	jmp    c0102668 <trap_dispatch+0x178>
    case IRQ_OFFSET + IRQ_KBD:
        c = cons_getc();
c01025ed:	e8 9f ef ff ff       	call   c0101591 <cons_getc>
c01025f2:	88 45 f3             	mov    %al,-0xd(%ebp)
        cprintf("kbd [%03d] %c\n", c, c);
c01025f5:	0f be 55 f3          	movsbl -0xd(%ebp),%edx
c01025f9:	0f be 45 f3          	movsbl -0xd(%ebp),%eax
c01025fd:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102601:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102605:	c7 04 24 0c a2 10 c0 	movl   $0xc010a20c,(%esp)
c010260c:	e8 42 dd ff ff       	call   c0100353 <cprintf>
        break;
c0102611:	eb 55                	jmp    c0102668 <trap_dispatch+0x178>
    //LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
    case T_SWITCH_TOU:
    case T_SWITCH_TOK:
        panic("T_SWITCH_** ??\n");
c0102613:	c7 44 24 08 1b a2 10 	movl   $0xc010a21b,0x8(%esp)
c010261a:	c0 
c010261b:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c0102622:	00 
c0102623:	c7 04 24 ce a1 10 c0 	movl   $0xc010a1ce,(%esp)
c010262a:	e8 f4 e5 ff ff       	call   c0100c23 <__panic>
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
    default:
        // in kernel, it must be a mistake
        if ((tf->tf_cs & 3) == 0) {
c010262f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102632:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c0102636:	0f b7 c0             	movzwl %ax,%eax
c0102639:	83 e0 03             	and    $0x3,%eax
c010263c:	85 c0                	test   %eax,%eax
c010263e:	75 28                	jne    c0102668 <trap_dispatch+0x178>
            print_trapframe(tf);
c0102640:	8b 45 08             	mov    0x8(%ebp),%eax
c0102643:	89 04 24             	mov    %eax,(%esp)
c0102646:	e8 4c fb ff ff       	call   c0102197 <print_trapframe>
            panic("unexpected trap in kernel.\n");
c010264b:	c7 44 24 08 2b a2 10 	movl   $0xc010a22b,0x8(%esp)
c0102652:	c0 
c0102653:	c7 44 24 04 dd 00 00 	movl   $0xdd,0x4(%esp)
c010265a:	00 
c010265b:	c7 04 24 ce a1 10 c0 	movl   $0xc010a1ce,(%esp)
c0102662:	e8 bc e5 ff ff       	call   c0100c23 <__panic>
        panic("T_SWITCH_** ??\n");
        break;
    case IRQ_OFFSET + IRQ_IDE1:
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
c0102667:	90                   	nop
        if ((tf->tf_cs & 3) == 0) {
            print_trapframe(tf);
            panic("unexpected trap in kernel.\n");
        }
    }
}
c0102668:	c9                   	leave  
c0102669:	c3                   	ret    

c010266a <trap>:
 * trap - handles or dispatches an exception/interrupt. if and when trap() returns,
 * the code in kern/trap/trapentry.S restores the old CPU state saved in the
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void
trap(struct trapframe *tf) {
c010266a:	55                   	push   %ebp
c010266b:	89 e5                	mov    %esp,%ebp
c010266d:	83 ec 18             	sub    $0x18,%esp
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
c0102670:	8b 45 08             	mov    0x8(%ebp),%eax
c0102673:	89 04 24             	mov    %eax,(%esp)
c0102676:	e8 75 fe ff ff       	call   c01024f0 <trap_dispatch>
}
c010267b:	c9                   	leave  
c010267c:	c3                   	ret    

c010267d <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c010267d:	1e                   	push   %ds
    pushl %es
c010267e:	06                   	push   %es
    pushl %fs
c010267f:	0f a0                	push   %fs
    pushl %gs
c0102681:	0f a8                	push   %gs
    pushal
c0102683:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c0102684:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c0102689:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c010268b:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c010268d:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c010268e:	e8 d7 ff ff ff       	call   c010266a <trap>

    # pop the pushed stack pointer
    popl %esp
c0102693:	5c                   	pop    %esp

c0102694 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:
    # restore registers from stack
    popal
c0102694:	61                   	popa   

    # restore %ds, %es, %fs and %gs
    popl %gs
c0102695:	0f a9                	pop    %gs
    popl %fs
c0102697:	0f a1                	pop    %fs
    popl %es
c0102699:	07                   	pop    %es
    popl %ds
c010269a:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c010269b:	83 c4 08             	add    $0x8,%esp
    iret
c010269e:	cf                   	iret   

c010269f <forkrets>:

.globl forkrets
forkrets:
    # set stack to this new process's trapframe
    movl 4(%esp), %esp
c010269f:	8b 64 24 04          	mov    0x4(%esp),%esp
    jmp __trapret
c01026a3:	e9 ec ff ff ff       	jmp    c0102694 <__trapret>

c01026a8 <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c01026a8:	6a 00                	push   $0x0
  pushl $0
c01026aa:	6a 00                	push   $0x0
  jmp __alltraps
c01026ac:	e9 cc ff ff ff       	jmp    c010267d <__alltraps>

c01026b1 <vector1>:
.globl vector1
vector1:
  pushl $0
c01026b1:	6a 00                	push   $0x0
  pushl $1
c01026b3:	6a 01                	push   $0x1
  jmp __alltraps
c01026b5:	e9 c3 ff ff ff       	jmp    c010267d <__alltraps>

c01026ba <vector2>:
.globl vector2
vector2:
  pushl $0
c01026ba:	6a 00                	push   $0x0
  pushl $2
c01026bc:	6a 02                	push   $0x2
  jmp __alltraps
c01026be:	e9 ba ff ff ff       	jmp    c010267d <__alltraps>

c01026c3 <vector3>:
.globl vector3
vector3:
  pushl $0
c01026c3:	6a 00                	push   $0x0
  pushl $3
c01026c5:	6a 03                	push   $0x3
  jmp __alltraps
c01026c7:	e9 b1 ff ff ff       	jmp    c010267d <__alltraps>

c01026cc <vector4>:
.globl vector4
vector4:
  pushl $0
c01026cc:	6a 00                	push   $0x0
  pushl $4
c01026ce:	6a 04                	push   $0x4
  jmp __alltraps
c01026d0:	e9 a8 ff ff ff       	jmp    c010267d <__alltraps>

c01026d5 <vector5>:
.globl vector5
vector5:
  pushl $0
c01026d5:	6a 00                	push   $0x0
  pushl $5
c01026d7:	6a 05                	push   $0x5
  jmp __alltraps
c01026d9:	e9 9f ff ff ff       	jmp    c010267d <__alltraps>

c01026de <vector6>:
.globl vector6
vector6:
  pushl $0
c01026de:	6a 00                	push   $0x0
  pushl $6
c01026e0:	6a 06                	push   $0x6
  jmp __alltraps
c01026e2:	e9 96 ff ff ff       	jmp    c010267d <__alltraps>

c01026e7 <vector7>:
.globl vector7
vector7:
  pushl $0
c01026e7:	6a 00                	push   $0x0
  pushl $7
c01026e9:	6a 07                	push   $0x7
  jmp __alltraps
c01026eb:	e9 8d ff ff ff       	jmp    c010267d <__alltraps>

c01026f0 <vector8>:
.globl vector8
vector8:
  pushl $8
c01026f0:	6a 08                	push   $0x8
  jmp __alltraps
c01026f2:	e9 86 ff ff ff       	jmp    c010267d <__alltraps>

c01026f7 <vector9>:
.globl vector9
vector9:
  pushl $9
c01026f7:	6a 09                	push   $0x9
  jmp __alltraps
c01026f9:	e9 7f ff ff ff       	jmp    c010267d <__alltraps>

c01026fe <vector10>:
.globl vector10
vector10:
  pushl $10
c01026fe:	6a 0a                	push   $0xa
  jmp __alltraps
c0102700:	e9 78 ff ff ff       	jmp    c010267d <__alltraps>

c0102705 <vector11>:
.globl vector11
vector11:
  pushl $11
c0102705:	6a 0b                	push   $0xb
  jmp __alltraps
c0102707:	e9 71 ff ff ff       	jmp    c010267d <__alltraps>

c010270c <vector12>:
.globl vector12
vector12:
  pushl $12
c010270c:	6a 0c                	push   $0xc
  jmp __alltraps
c010270e:	e9 6a ff ff ff       	jmp    c010267d <__alltraps>

c0102713 <vector13>:
.globl vector13
vector13:
  pushl $13
c0102713:	6a 0d                	push   $0xd
  jmp __alltraps
c0102715:	e9 63 ff ff ff       	jmp    c010267d <__alltraps>

c010271a <vector14>:
.globl vector14
vector14:
  pushl $14
c010271a:	6a 0e                	push   $0xe
  jmp __alltraps
c010271c:	e9 5c ff ff ff       	jmp    c010267d <__alltraps>

c0102721 <vector15>:
.globl vector15
vector15:
  pushl $0
c0102721:	6a 00                	push   $0x0
  pushl $15
c0102723:	6a 0f                	push   $0xf
  jmp __alltraps
c0102725:	e9 53 ff ff ff       	jmp    c010267d <__alltraps>

c010272a <vector16>:
.globl vector16
vector16:
  pushl $0
c010272a:	6a 00                	push   $0x0
  pushl $16
c010272c:	6a 10                	push   $0x10
  jmp __alltraps
c010272e:	e9 4a ff ff ff       	jmp    c010267d <__alltraps>

c0102733 <vector17>:
.globl vector17
vector17:
  pushl $17
c0102733:	6a 11                	push   $0x11
  jmp __alltraps
c0102735:	e9 43 ff ff ff       	jmp    c010267d <__alltraps>

c010273a <vector18>:
.globl vector18
vector18:
  pushl $0
c010273a:	6a 00                	push   $0x0
  pushl $18
c010273c:	6a 12                	push   $0x12
  jmp __alltraps
c010273e:	e9 3a ff ff ff       	jmp    c010267d <__alltraps>

c0102743 <vector19>:
.globl vector19
vector19:
  pushl $0
c0102743:	6a 00                	push   $0x0
  pushl $19
c0102745:	6a 13                	push   $0x13
  jmp __alltraps
c0102747:	e9 31 ff ff ff       	jmp    c010267d <__alltraps>

c010274c <vector20>:
.globl vector20
vector20:
  pushl $0
c010274c:	6a 00                	push   $0x0
  pushl $20
c010274e:	6a 14                	push   $0x14
  jmp __alltraps
c0102750:	e9 28 ff ff ff       	jmp    c010267d <__alltraps>

c0102755 <vector21>:
.globl vector21
vector21:
  pushl $0
c0102755:	6a 00                	push   $0x0
  pushl $21
c0102757:	6a 15                	push   $0x15
  jmp __alltraps
c0102759:	e9 1f ff ff ff       	jmp    c010267d <__alltraps>

c010275e <vector22>:
.globl vector22
vector22:
  pushl $0
c010275e:	6a 00                	push   $0x0
  pushl $22
c0102760:	6a 16                	push   $0x16
  jmp __alltraps
c0102762:	e9 16 ff ff ff       	jmp    c010267d <__alltraps>

c0102767 <vector23>:
.globl vector23
vector23:
  pushl $0
c0102767:	6a 00                	push   $0x0
  pushl $23
c0102769:	6a 17                	push   $0x17
  jmp __alltraps
c010276b:	e9 0d ff ff ff       	jmp    c010267d <__alltraps>

c0102770 <vector24>:
.globl vector24
vector24:
  pushl $0
c0102770:	6a 00                	push   $0x0
  pushl $24
c0102772:	6a 18                	push   $0x18
  jmp __alltraps
c0102774:	e9 04 ff ff ff       	jmp    c010267d <__alltraps>

c0102779 <vector25>:
.globl vector25
vector25:
  pushl $0
c0102779:	6a 00                	push   $0x0
  pushl $25
c010277b:	6a 19                	push   $0x19
  jmp __alltraps
c010277d:	e9 fb fe ff ff       	jmp    c010267d <__alltraps>

c0102782 <vector26>:
.globl vector26
vector26:
  pushl $0
c0102782:	6a 00                	push   $0x0
  pushl $26
c0102784:	6a 1a                	push   $0x1a
  jmp __alltraps
c0102786:	e9 f2 fe ff ff       	jmp    c010267d <__alltraps>

c010278b <vector27>:
.globl vector27
vector27:
  pushl $0
c010278b:	6a 00                	push   $0x0
  pushl $27
c010278d:	6a 1b                	push   $0x1b
  jmp __alltraps
c010278f:	e9 e9 fe ff ff       	jmp    c010267d <__alltraps>

c0102794 <vector28>:
.globl vector28
vector28:
  pushl $0
c0102794:	6a 00                	push   $0x0
  pushl $28
c0102796:	6a 1c                	push   $0x1c
  jmp __alltraps
c0102798:	e9 e0 fe ff ff       	jmp    c010267d <__alltraps>

c010279d <vector29>:
.globl vector29
vector29:
  pushl $0
c010279d:	6a 00                	push   $0x0
  pushl $29
c010279f:	6a 1d                	push   $0x1d
  jmp __alltraps
c01027a1:	e9 d7 fe ff ff       	jmp    c010267d <__alltraps>

c01027a6 <vector30>:
.globl vector30
vector30:
  pushl $0
c01027a6:	6a 00                	push   $0x0
  pushl $30
c01027a8:	6a 1e                	push   $0x1e
  jmp __alltraps
c01027aa:	e9 ce fe ff ff       	jmp    c010267d <__alltraps>

c01027af <vector31>:
.globl vector31
vector31:
  pushl $0
c01027af:	6a 00                	push   $0x0
  pushl $31
c01027b1:	6a 1f                	push   $0x1f
  jmp __alltraps
c01027b3:	e9 c5 fe ff ff       	jmp    c010267d <__alltraps>

c01027b8 <vector32>:
.globl vector32
vector32:
  pushl $0
c01027b8:	6a 00                	push   $0x0
  pushl $32
c01027ba:	6a 20                	push   $0x20
  jmp __alltraps
c01027bc:	e9 bc fe ff ff       	jmp    c010267d <__alltraps>

c01027c1 <vector33>:
.globl vector33
vector33:
  pushl $0
c01027c1:	6a 00                	push   $0x0
  pushl $33
c01027c3:	6a 21                	push   $0x21
  jmp __alltraps
c01027c5:	e9 b3 fe ff ff       	jmp    c010267d <__alltraps>

c01027ca <vector34>:
.globl vector34
vector34:
  pushl $0
c01027ca:	6a 00                	push   $0x0
  pushl $34
c01027cc:	6a 22                	push   $0x22
  jmp __alltraps
c01027ce:	e9 aa fe ff ff       	jmp    c010267d <__alltraps>

c01027d3 <vector35>:
.globl vector35
vector35:
  pushl $0
c01027d3:	6a 00                	push   $0x0
  pushl $35
c01027d5:	6a 23                	push   $0x23
  jmp __alltraps
c01027d7:	e9 a1 fe ff ff       	jmp    c010267d <__alltraps>

c01027dc <vector36>:
.globl vector36
vector36:
  pushl $0
c01027dc:	6a 00                	push   $0x0
  pushl $36
c01027de:	6a 24                	push   $0x24
  jmp __alltraps
c01027e0:	e9 98 fe ff ff       	jmp    c010267d <__alltraps>

c01027e5 <vector37>:
.globl vector37
vector37:
  pushl $0
c01027e5:	6a 00                	push   $0x0
  pushl $37
c01027e7:	6a 25                	push   $0x25
  jmp __alltraps
c01027e9:	e9 8f fe ff ff       	jmp    c010267d <__alltraps>

c01027ee <vector38>:
.globl vector38
vector38:
  pushl $0
c01027ee:	6a 00                	push   $0x0
  pushl $38
c01027f0:	6a 26                	push   $0x26
  jmp __alltraps
c01027f2:	e9 86 fe ff ff       	jmp    c010267d <__alltraps>

c01027f7 <vector39>:
.globl vector39
vector39:
  pushl $0
c01027f7:	6a 00                	push   $0x0
  pushl $39
c01027f9:	6a 27                	push   $0x27
  jmp __alltraps
c01027fb:	e9 7d fe ff ff       	jmp    c010267d <__alltraps>

c0102800 <vector40>:
.globl vector40
vector40:
  pushl $0
c0102800:	6a 00                	push   $0x0
  pushl $40
c0102802:	6a 28                	push   $0x28
  jmp __alltraps
c0102804:	e9 74 fe ff ff       	jmp    c010267d <__alltraps>

c0102809 <vector41>:
.globl vector41
vector41:
  pushl $0
c0102809:	6a 00                	push   $0x0
  pushl $41
c010280b:	6a 29                	push   $0x29
  jmp __alltraps
c010280d:	e9 6b fe ff ff       	jmp    c010267d <__alltraps>

c0102812 <vector42>:
.globl vector42
vector42:
  pushl $0
c0102812:	6a 00                	push   $0x0
  pushl $42
c0102814:	6a 2a                	push   $0x2a
  jmp __alltraps
c0102816:	e9 62 fe ff ff       	jmp    c010267d <__alltraps>

c010281b <vector43>:
.globl vector43
vector43:
  pushl $0
c010281b:	6a 00                	push   $0x0
  pushl $43
c010281d:	6a 2b                	push   $0x2b
  jmp __alltraps
c010281f:	e9 59 fe ff ff       	jmp    c010267d <__alltraps>

c0102824 <vector44>:
.globl vector44
vector44:
  pushl $0
c0102824:	6a 00                	push   $0x0
  pushl $44
c0102826:	6a 2c                	push   $0x2c
  jmp __alltraps
c0102828:	e9 50 fe ff ff       	jmp    c010267d <__alltraps>

c010282d <vector45>:
.globl vector45
vector45:
  pushl $0
c010282d:	6a 00                	push   $0x0
  pushl $45
c010282f:	6a 2d                	push   $0x2d
  jmp __alltraps
c0102831:	e9 47 fe ff ff       	jmp    c010267d <__alltraps>

c0102836 <vector46>:
.globl vector46
vector46:
  pushl $0
c0102836:	6a 00                	push   $0x0
  pushl $46
c0102838:	6a 2e                	push   $0x2e
  jmp __alltraps
c010283a:	e9 3e fe ff ff       	jmp    c010267d <__alltraps>

c010283f <vector47>:
.globl vector47
vector47:
  pushl $0
c010283f:	6a 00                	push   $0x0
  pushl $47
c0102841:	6a 2f                	push   $0x2f
  jmp __alltraps
c0102843:	e9 35 fe ff ff       	jmp    c010267d <__alltraps>

c0102848 <vector48>:
.globl vector48
vector48:
  pushl $0
c0102848:	6a 00                	push   $0x0
  pushl $48
c010284a:	6a 30                	push   $0x30
  jmp __alltraps
c010284c:	e9 2c fe ff ff       	jmp    c010267d <__alltraps>

c0102851 <vector49>:
.globl vector49
vector49:
  pushl $0
c0102851:	6a 00                	push   $0x0
  pushl $49
c0102853:	6a 31                	push   $0x31
  jmp __alltraps
c0102855:	e9 23 fe ff ff       	jmp    c010267d <__alltraps>

c010285a <vector50>:
.globl vector50
vector50:
  pushl $0
c010285a:	6a 00                	push   $0x0
  pushl $50
c010285c:	6a 32                	push   $0x32
  jmp __alltraps
c010285e:	e9 1a fe ff ff       	jmp    c010267d <__alltraps>

c0102863 <vector51>:
.globl vector51
vector51:
  pushl $0
c0102863:	6a 00                	push   $0x0
  pushl $51
c0102865:	6a 33                	push   $0x33
  jmp __alltraps
c0102867:	e9 11 fe ff ff       	jmp    c010267d <__alltraps>

c010286c <vector52>:
.globl vector52
vector52:
  pushl $0
c010286c:	6a 00                	push   $0x0
  pushl $52
c010286e:	6a 34                	push   $0x34
  jmp __alltraps
c0102870:	e9 08 fe ff ff       	jmp    c010267d <__alltraps>

c0102875 <vector53>:
.globl vector53
vector53:
  pushl $0
c0102875:	6a 00                	push   $0x0
  pushl $53
c0102877:	6a 35                	push   $0x35
  jmp __alltraps
c0102879:	e9 ff fd ff ff       	jmp    c010267d <__alltraps>

c010287e <vector54>:
.globl vector54
vector54:
  pushl $0
c010287e:	6a 00                	push   $0x0
  pushl $54
c0102880:	6a 36                	push   $0x36
  jmp __alltraps
c0102882:	e9 f6 fd ff ff       	jmp    c010267d <__alltraps>

c0102887 <vector55>:
.globl vector55
vector55:
  pushl $0
c0102887:	6a 00                	push   $0x0
  pushl $55
c0102889:	6a 37                	push   $0x37
  jmp __alltraps
c010288b:	e9 ed fd ff ff       	jmp    c010267d <__alltraps>

c0102890 <vector56>:
.globl vector56
vector56:
  pushl $0
c0102890:	6a 00                	push   $0x0
  pushl $56
c0102892:	6a 38                	push   $0x38
  jmp __alltraps
c0102894:	e9 e4 fd ff ff       	jmp    c010267d <__alltraps>

c0102899 <vector57>:
.globl vector57
vector57:
  pushl $0
c0102899:	6a 00                	push   $0x0
  pushl $57
c010289b:	6a 39                	push   $0x39
  jmp __alltraps
c010289d:	e9 db fd ff ff       	jmp    c010267d <__alltraps>

c01028a2 <vector58>:
.globl vector58
vector58:
  pushl $0
c01028a2:	6a 00                	push   $0x0
  pushl $58
c01028a4:	6a 3a                	push   $0x3a
  jmp __alltraps
c01028a6:	e9 d2 fd ff ff       	jmp    c010267d <__alltraps>

c01028ab <vector59>:
.globl vector59
vector59:
  pushl $0
c01028ab:	6a 00                	push   $0x0
  pushl $59
c01028ad:	6a 3b                	push   $0x3b
  jmp __alltraps
c01028af:	e9 c9 fd ff ff       	jmp    c010267d <__alltraps>

c01028b4 <vector60>:
.globl vector60
vector60:
  pushl $0
c01028b4:	6a 00                	push   $0x0
  pushl $60
c01028b6:	6a 3c                	push   $0x3c
  jmp __alltraps
c01028b8:	e9 c0 fd ff ff       	jmp    c010267d <__alltraps>

c01028bd <vector61>:
.globl vector61
vector61:
  pushl $0
c01028bd:	6a 00                	push   $0x0
  pushl $61
c01028bf:	6a 3d                	push   $0x3d
  jmp __alltraps
c01028c1:	e9 b7 fd ff ff       	jmp    c010267d <__alltraps>

c01028c6 <vector62>:
.globl vector62
vector62:
  pushl $0
c01028c6:	6a 00                	push   $0x0
  pushl $62
c01028c8:	6a 3e                	push   $0x3e
  jmp __alltraps
c01028ca:	e9 ae fd ff ff       	jmp    c010267d <__alltraps>

c01028cf <vector63>:
.globl vector63
vector63:
  pushl $0
c01028cf:	6a 00                	push   $0x0
  pushl $63
c01028d1:	6a 3f                	push   $0x3f
  jmp __alltraps
c01028d3:	e9 a5 fd ff ff       	jmp    c010267d <__alltraps>

c01028d8 <vector64>:
.globl vector64
vector64:
  pushl $0
c01028d8:	6a 00                	push   $0x0
  pushl $64
c01028da:	6a 40                	push   $0x40
  jmp __alltraps
c01028dc:	e9 9c fd ff ff       	jmp    c010267d <__alltraps>

c01028e1 <vector65>:
.globl vector65
vector65:
  pushl $0
c01028e1:	6a 00                	push   $0x0
  pushl $65
c01028e3:	6a 41                	push   $0x41
  jmp __alltraps
c01028e5:	e9 93 fd ff ff       	jmp    c010267d <__alltraps>

c01028ea <vector66>:
.globl vector66
vector66:
  pushl $0
c01028ea:	6a 00                	push   $0x0
  pushl $66
c01028ec:	6a 42                	push   $0x42
  jmp __alltraps
c01028ee:	e9 8a fd ff ff       	jmp    c010267d <__alltraps>

c01028f3 <vector67>:
.globl vector67
vector67:
  pushl $0
c01028f3:	6a 00                	push   $0x0
  pushl $67
c01028f5:	6a 43                	push   $0x43
  jmp __alltraps
c01028f7:	e9 81 fd ff ff       	jmp    c010267d <__alltraps>

c01028fc <vector68>:
.globl vector68
vector68:
  pushl $0
c01028fc:	6a 00                	push   $0x0
  pushl $68
c01028fe:	6a 44                	push   $0x44
  jmp __alltraps
c0102900:	e9 78 fd ff ff       	jmp    c010267d <__alltraps>

c0102905 <vector69>:
.globl vector69
vector69:
  pushl $0
c0102905:	6a 00                	push   $0x0
  pushl $69
c0102907:	6a 45                	push   $0x45
  jmp __alltraps
c0102909:	e9 6f fd ff ff       	jmp    c010267d <__alltraps>

c010290e <vector70>:
.globl vector70
vector70:
  pushl $0
c010290e:	6a 00                	push   $0x0
  pushl $70
c0102910:	6a 46                	push   $0x46
  jmp __alltraps
c0102912:	e9 66 fd ff ff       	jmp    c010267d <__alltraps>

c0102917 <vector71>:
.globl vector71
vector71:
  pushl $0
c0102917:	6a 00                	push   $0x0
  pushl $71
c0102919:	6a 47                	push   $0x47
  jmp __alltraps
c010291b:	e9 5d fd ff ff       	jmp    c010267d <__alltraps>

c0102920 <vector72>:
.globl vector72
vector72:
  pushl $0
c0102920:	6a 00                	push   $0x0
  pushl $72
c0102922:	6a 48                	push   $0x48
  jmp __alltraps
c0102924:	e9 54 fd ff ff       	jmp    c010267d <__alltraps>

c0102929 <vector73>:
.globl vector73
vector73:
  pushl $0
c0102929:	6a 00                	push   $0x0
  pushl $73
c010292b:	6a 49                	push   $0x49
  jmp __alltraps
c010292d:	e9 4b fd ff ff       	jmp    c010267d <__alltraps>

c0102932 <vector74>:
.globl vector74
vector74:
  pushl $0
c0102932:	6a 00                	push   $0x0
  pushl $74
c0102934:	6a 4a                	push   $0x4a
  jmp __alltraps
c0102936:	e9 42 fd ff ff       	jmp    c010267d <__alltraps>

c010293b <vector75>:
.globl vector75
vector75:
  pushl $0
c010293b:	6a 00                	push   $0x0
  pushl $75
c010293d:	6a 4b                	push   $0x4b
  jmp __alltraps
c010293f:	e9 39 fd ff ff       	jmp    c010267d <__alltraps>

c0102944 <vector76>:
.globl vector76
vector76:
  pushl $0
c0102944:	6a 00                	push   $0x0
  pushl $76
c0102946:	6a 4c                	push   $0x4c
  jmp __alltraps
c0102948:	e9 30 fd ff ff       	jmp    c010267d <__alltraps>

c010294d <vector77>:
.globl vector77
vector77:
  pushl $0
c010294d:	6a 00                	push   $0x0
  pushl $77
c010294f:	6a 4d                	push   $0x4d
  jmp __alltraps
c0102951:	e9 27 fd ff ff       	jmp    c010267d <__alltraps>

c0102956 <vector78>:
.globl vector78
vector78:
  pushl $0
c0102956:	6a 00                	push   $0x0
  pushl $78
c0102958:	6a 4e                	push   $0x4e
  jmp __alltraps
c010295a:	e9 1e fd ff ff       	jmp    c010267d <__alltraps>

c010295f <vector79>:
.globl vector79
vector79:
  pushl $0
c010295f:	6a 00                	push   $0x0
  pushl $79
c0102961:	6a 4f                	push   $0x4f
  jmp __alltraps
c0102963:	e9 15 fd ff ff       	jmp    c010267d <__alltraps>

c0102968 <vector80>:
.globl vector80
vector80:
  pushl $0
c0102968:	6a 00                	push   $0x0
  pushl $80
c010296a:	6a 50                	push   $0x50
  jmp __alltraps
c010296c:	e9 0c fd ff ff       	jmp    c010267d <__alltraps>

c0102971 <vector81>:
.globl vector81
vector81:
  pushl $0
c0102971:	6a 00                	push   $0x0
  pushl $81
c0102973:	6a 51                	push   $0x51
  jmp __alltraps
c0102975:	e9 03 fd ff ff       	jmp    c010267d <__alltraps>

c010297a <vector82>:
.globl vector82
vector82:
  pushl $0
c010297a:	6a 00                	push   $0x0
  pushl $82
c010297c:	6a 52                	push   $0x52
  jmp __alltraps
c010297e:	e9 fa fc ff ff       	jmp    c010267d <__alltraps>

c0102983 <vector83>:
.globl vector83
vector83:
  pushl $0
c0102983:	6a 00                	push   $0x0
  pushl $83
c0102985:	6a 53                	push   $0x53
  jmp __alltraps
c0102987:	e9 f1 fc ff ff       	jmp    c010267d <__alltraps>

c010298c <vector84>:
.globl vector84
vector84:
  pushl $0
c010298c:	6a 00                	push   $0x0
  pushl $84
c010298e:	6a 54                	push   $0x54
  jmp __alltraps
c0102990:	e9 e8 fc ff ff       	jmp    c010267d <__alltraps>

c0102995 <vector85>:
.globl vector85
vector85:
  pushl $0
c0102995:	6a 00                	push   $0x0
  pushl $85
c0102997:	6a 55                	push   $0x55
  jmp __alltraps
c0102999:	e9 df fc ff ff       	jmp    c010267d <__alltraps>

c010299e <vector86>:
.globl vector86
vector86:
  pushl $0
c010299e:	6a 00                	push   $0x0
  pushl $86
c01029a0:	6a 56                	push   $0x56
  jmp __alltraps
c01029a2:	e9 d6 fc ff ff       	jmp    c010267d <__alltraps>

c01029a7 <vector87>:
.globl vector87
vector87:
  pushl $0
c01029a7:	6a 00                	push   $0x0
  pushl $87
c01029a9:	6a 57                	push   $0x57
  jmp __alltraps
c01029ab:	e9 cd fc ff ff       	jmp    c010267d <__alltraps>

c01029b0 <vector88>:
.globl vector88
vector88:
  pushl $0
c01029b0:	6a 00                	push   $0x0
  pushl $88
c01029b2:	6a 58                	push   $0x58
  jmp __alltraps
c01029b4:	e9 c4 fc ff ff       	jmp    c010267d <__alltraps>

c01029b9 <vector89>:
.globl vector89
vector89:
  pushl $0
c01029b9:	6a 00                	push   $0x0
  pushl $89
c01029bb:	6a 59                	push   $0x59
  jmp __alltraps
c01029bd:	e9 bb fc ff ff       	jmp    c010267d <__alltraps>

c01029c2 <vector90>:
.globl vector90
vector90:
  pushl $0
c01029c2:	6a 00                	push   $0x0
  pushl $90
c01029c4:	6a 5a                	push   $0x5a
  jmp __alltraps
c01029c6:	e9 b2 fc ff ff       	jmp    c010267d <__alltraps>

c01029cb <vector91>:
.globl vector91
vector91:
  pushl $0
c01029cb:	6a 00                	push   $0x0
  pushl $91
c01029cd:	6a 5b                	push   $0x5b
  jmp __alltraps
c01029cf:	e9 a9 fc ff ff       	jmp    c010267d <__alltraps>

c01029d4 <vector92>:
.globl vector92
vector92:
  pushl $0
c01029d4:	6a 00                	push   $0x0
  pushl $92
c01029d6:	6a 5c                	push   $0x5c
  jmp __alltraps
c01029d8:	e9 a0 fc ff ff       	jmp    c010267d <__alltraps>

c01029dd <vector93>:
.globl vector93
vector93:
  pushl $0
c01029dd:	6a 00                	push   $0x0
  pushl $93
c01029df:	6a 5d                	push   $0x5d
  jmp __alltraps
c01029e1:	e9 97 fc ff ff       	jmp    c010267d <__alltraps>

c01029e6 <vector94>:
.globl vector94
vector94:
  pushl $0
c01029e6:	6a 00                	push   $0x0
  pushl $94
c01029e8:	6a 5e                	push   $0x5e
  jmp __alltraps
c01029ea:	e9 8e fc ff ff       	jmp    c010267d <__alltraps>

c01029ef <vector95>:
.globl vector95
vector95:
  pushl $0
c01029ef:	6a 00                	push   $0x0
  pushl $95
c01029f1:	6a 5f                	push   $0x5f
  jmp __alltraps
c01029f3:	e9 85 fc ff ff       	jmp    c010267d <__alltraps>

c01029f8 <vector96>:
.globl vector96
vector96:
  pushl $0
c01029f8:	6a 00                	push   $0x0
  pushl $96
c01029fa:	6a 60                	push   $0x60
  jmp __alltraps
c01029fc:	e9 7c fc ff ff       	jmp    c010267d <__alltraps>

c0102a01 <vector97>:
.globl vector97
vector97:
  pushl $0
c0102a01:	6a 00                	push   $0x0
  pushl $97
c0102a03:	6a 61                	push   $0x61
  jmp __alltraps
c0102a05:	e9 73 fc ff ff       	jmp    c010267d <__alltraps>

c0102a0a <vector98>:
.globl vector98
vector98:
  pushl $0
c0102a0a:	6a 00                	push   $0x0
  pushl $98
c0102a0c:	6a 62                	push   $0x62
  jmp __alltraps
c0102a0e:	e9 6a fc ff ff       	jmp    c010267d <__alltraps>

c0102a13 <vector99>:
.globl vector99
vector99:
  pushl $0
c0102a13:	6a 00                	push   $0x0
  pushl $99
c0102a15:	6a 63                	push   $0x63
  jmp __alltraps
c0102a17:	e9 61 fc ff ff       	jmp    c010267d <__alltraps>

c0102a1c <vector100>:
.globl vector100
vector100:
  pushl $0
c0102a1c:	6a 00                	push   $0x0
  pushl $100
c0102a1e:	6a 64                	push   $0x64
  jmp __alltraps
c0102a20:	e9 58 fc ff ff       	jmp    c010267d <__alltraps>

c0102a25 <vector101>:
.globl vector101
vector101:
  pushl $0
c0102a25:	6a 00                	push   $0x0
  pushl $101
c0102a27:	6a 65                	push   $0x65
  jmp __alltraps
c0102a29:	e9 4f fc ff ff       	jmp    c010267d <__alltraps>

c0102a2e <vector102>:
.globl vector102
vector102:
  pushl $0
c0102a2e:	6a 00                	push   $0x0
  pushl $102
c0102a30:	6a 66                	push   $0x66
  jmp __alltraps
c0102a32:	e9 46 fc ff ff       	jmp    c010267d <__alltraps>

c0102a37 <vector103>:
.globl vector103
vector103:
  pushl $0
c0102a37:	6a 00                	push   $0x0
  pushl $103
c0102a39:	6a 67                	push   $0x67
  jmp __alltraps
c0102a3b:	e9 3d fc ff ff       	jmp    c010267d <__alltraps>

c0102a40 <vector104>:
.globl vector104
vector104:
  pushl $0
c0102a40:	6a 00                	push   $0x0
  pushl $104
c0102a42:	6a 68                	push   $0x68
  jmp __alltraps
c0102a44:	e9 34 fc ff ff       	jmp    c010267d <__alltraps>

c0102a49 <vector105>:
.globl vector105
vector105:
  pushl $0
c0102a49:	6a 00                	push   $0x0
  pushl $105
c0102a4b:	6a 69                	push   $0x69
  jmp __alltraps
c0102a4d:	e9 2b fc ff ff       	jmp    c010267d <__alltraps>

c0102a52 <vector106>:
.globl vector106
vector106:
  pushl $0
c0102a52:	6a 00                	push   $0x0
  pushl $106
c0102a54:	6a 6a                	push   $0x6a
  jmp __alltraps
c0102a56:	e9 22 fc ff ff       	jmp    c010267d <__alltraps>

c0102a5b <vector107>:
.globl vector107
vector107:
  pushl $0
c0102a5b:	6a 00                	push   $0x0
  pushl $107
c0102a5d:	6a 6b                	push   $0x6b
  jmp __alltraps
c0102a5f:	e9 19 fc ff ff       	jmp    c010267d <__alltraps>

c0102a64 <vector108>:
.globl vector108
vector108:
  pushl $0
c0102a64:	6a 00                	push   $0x0
  pushl $108
c0102a66:	6a 6c                	push   $0x6c
  jmp __alltraps
c0102a68:	e9 10 fc ff ff       	jmp    c010267d <__alltraps>

c0102a6d <vector109>:
.globl vector109
vector109:
  pushl $0
c0102a6d:	6a 00                	push   $0x0
  pushl $109
c0102a6f:	6a 6d                	push   $0x6d
  jmp __alltraps
c0102a71:	e9 07 fc ff ff       	jmp    c010267d <__alltraps>

c0102a76 <vector110>:
.globl vector110
vector110:
  pushl $0
c0102a76:	6a 00                	push   $0x0
  pushl $110
c0102a78:	6a 6e                	push   $0x6e
  jmp __alltraps
c0102a7a:	e9 fe fb ff ff       	jmp    c010267d <__alltraps>

c0102a7f <vector111>:
.globl vector111
vector111:
  pushl $0
c0102a7f:	6a 00                	push   $0x0
  pushl $111
c0102a81:	6a 6f                	push   $0x6f
  jmp __alltraps
c0102a83:	e9 f5 fb ff ff       	jmp    c010267d <__alltraps>

c0102a88 <vector112>:
.globl vector112
vector112:
  pushl $0
c0102a88:	6a 00                	push   $0x0
  pushl $112
c0102a8a:	6a 70                	push   $0x70
  jmp __alltraps
c0102a8c:	e9 ec fb ff ff       	jmp    c010267d <__alltraps>

c0102a91 <vector113>:
.globl vector113
vector113:
  pushl $0
c0102a91:	6a 00                	push   $0x0
  pushl $113
c0102a93:	6a 71                	push   $0x71
  jmp __alltraps
c0102a95:	e9 e3 fb ff ff       	jmp    c010267d <__alltraps>

c0102a9a <vector114>:
.globl vector114
vector114:
  pushl $0
c0102a9a:	6a 00                	push   $0x0
  pushl $114
c0102a9c:	6a 72                	push   $0x72
  jmp __alltraps
c0102a9e:	e9 da fb ff ff       	jmp    c010267d <__alltraps>

c0102aa3 <vector115>:
.globl vector115
vector115:
  pushl $0
c0102aa3:	6a 00                	push   $0x0
  pushl $115
c0102aa5:	6a 73                	push   $0x73
  jmp __alltraps
c0102aa7:	e9 d1 fb ff ff       	jmp    c010267d <__alltraps>

c0102aac <vector116>:
.globl vector116
vector116:
  pushl $0
c0102aac:	6a 00                	push   $0x0
  pushl $116
c0102aae:	6a 74                	push   $0x74
  jmp __alltraps
c0102ab0:	e9 c8 fb ff ff       	jmp    c010267d <__alltraps>

c0102ab5 <vector117>:
.globl vector117
vector117:
  pushl $0
c0102ab5:	6a 00                	push   $0x0
  pushl $117
c0102ab7:	6a 75                	push   $0x75
  jmp __alltraps
c0102ab9:	e9 bf fb ff ff       	jmp    c010267d <__alltraps>

c0102abe <vector118>:
.globl vector118
vector118:
  pushl $0
c0102abe:	6a 00                	push   $0x0
  pushl $118
c0102ac0:	6a 76                	push   $0x76
  jmp __alltraps
c0102ac2:	e9 b6 fb ff ff       	jmp    c010267d <__alltraps>

c0102ac7 <vector119>:
.globl vector119
vector119:
  pushl $0
c0102ac7:	6a 00                	push   $0x0
  pushl $119
c0102ac9:	6a 77                	push   $0x77
  jmp __alltraps
c0102acb:	e9 ad fb ff ff       	jmp    c010267d <__alltraps>

c0102ad0 <vector120>:
.globl vector120
vector120:
  pushl $0
c0102ad0:	6a 00                	push   $0x0
  pushl $120
c0102ad2:	6a 78                	push   $0x78
  jmp __alltraps
c0102ad4:	e9 a4 fb ff ff       	jmp    c010267d <__alltraps>

c0102ad9 <vector121>:
.globl vector121
vector121:
  pushl $0
c0102ad9:	6a 00                	push   $0x0
  pushl $121
c0102adb:	6a 79                	push   $0x79
  jmp __alltraps
c0102add:	e9 9b fb ff ff       	jmp    c010267d <__alltraps>

c0102ae2 <vector122>:
.globl vector122
vector122:
  pushl $0
c0102ae2:	6a 00                	push   $0x0
  pushl $122
c0102ae4:	6a 7a                	push   $0x7a
  jmp __alltraps
c0102ae6:	e9 92 fb ff ff       	jmp    c010267d <__alltraps>

c0102aeb <vector123>:
.globl vector123
vector123:
  pushl $0
c0102aeb:	6a 00                	push   $0x0
  pushl $123
c0102aed:	6a 7b                	push   $0x7b
  jmp __alltraps
c0102aef:	e9 89 fb ff ff       	jmp    c010267d <__alltraps>

c0102af4 <vector124>:
.globl vector124
vector124:
  pushl $0
c0102af4:	6a 00                	push   $0x0
  pushl $124
c0102af6:	6a 7c                	push   $0x7c
  jmp __alltraps
c0102af8:	e9 80 fb ff ff       	jmp    c010267d <__alltraps>

c0102afd <vector125>:
.globl vector125
vector125:
  pushl $0
c0102afd:	6a 00                	push   $0x0
  pushl $125
c0102aff:	6a 7d                	push   $0x7d
  jmp __alltraps
c0102b01:	e9 77 fb ff ff       	jmp    c010267d <__alltraps>

c0102b06 <vector126>:
.globl vector126
vector126:
  pushl $0
c0102b06:	6a 00                	push   $0x0
  pushl $126
c0102b08:	6a 7e                	push   $0x7e
  jmp __alltraps
c0102b0a:	e9 6e fb ff ff       	jmp    c010267d <__alltraps>

c0102b0f <vector127>:
.globl vector127
vector127:
  pushl $0
c0102b0f:	6a 00                	push   $0x0
  pushl $127
c0102b11:	6a 7f                	push   $0x7f
  jmp __alltraps
c0102b13:	e9 65 fb ff ff       	jmp    c010267d <__alltraps>

c0102b18 <vector128>:
.globl vector128
vector128:
  pushl $0
c0102b18:	6a 00                	push   $0x0
  pushl $128
c0102b1a:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c0102b1f:	e9 59 fb ff ff       	jmp    c010267d <__alltraps>

c0102b24 <vector129>:
.globl vector129
vector129:
  pushl $0
c0102b24:	6a 00                	push   $0x0
  pushl $129
c0102b26:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c0102b2b:	e9 4d fb ff ff       	jmp    c010267d <__alltraps>

c0102b30 <vector130>:
.globl vector130
vector130:
  pushl $0
c0102b30:	6a 00                	push   $0x0
  pushl $130
c0102b32:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c0102b37:	e9 41 fb ff ff       	jmp    c010267d <__alltraps>

c0102b3c <vector131>:
.globl vector131
vector131:
  pushl $0
c0102b3c:	6a 00                	push   $0x0
  pushl $131
c0102b3e:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0102b43:	e9 35 fb ff ff       	jmp    c010267d <__alltraps>

c0102b48 <vector132>:
.globl vector132
vector132:
  pushl $0
c0102b48:	6a 00                	push   $0x0
  pushl $132
c0102b4a:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0102b4f:	e9 29 fb ff ff       	jmp    c010267d <__alltraps>

c0102b54 <vector133>:
.globl vector133
vector133:
  pushl $0
c0102b54:	6a 00                	push   $0x0
  pushl $133
c0102b56:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c0102b5b:	e9 1d fb ff ff       	jmp    c010267d <__alltraps>

c0102b60 <vector134>:
.globl vector134
vector134:
  pushl $0
c0102b60:	6a 00                	push   $0x0
  pushl $134
c0102b62:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c0102b67:	e9 11 fb ff ff       	jmp    c010267d <__alltraps>

c0102b6c <vector135>:
.globl vector135
vector135:
  pushl $0
c0102b6c:	6a 00                	push   $0x0
  pushl $135
c0102b6e:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0102b73:	e9 05 fb ff ff       	jmp    c010267d <__alltraps>

c0102b78 <vector136>:
.globl vector136
vector136:
  pushl $0
c0102b78:	6a 00                	push   $0x0
  pushl $136
c0102b7a:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0102b7f:	e9 f9 fa ff ff       	jmp    c010267d <__alltraps>

c0102b84 <vector137>:
.globl vector137
vector137:
  pushl $0
c0102b84:	6a 00                	push   $0x0
  pushl $137
c0102b86:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c0102b8b:	e9 ed fa ff ff       	jmp    c010267d <__alltraps>

c0102b90 <vector138>:
.globl vector138
vector138:
  pushl $0
c0102b90:	6a 00                	push   $0x0
  pushl $138
c0102b92:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c0102b97:	e9 e1 fa ff ff       	jmp    c010267d <__alltraps>

c0102b9c <vector139>:
.globl vector139
vector139:
  pushl $0
c0102b9c:	6a 00                	push   $0x0
  pushl $139
c0102b9e:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c0102ba3:	e9 d5 fa ff ff       	jmp    c010267d <__alltraps>

c0102ba8 <vector140>:
.globl vector140
vector140:
  pushl $0
c0102ba8:	6a 00                	push   $0x0
  pushl $140
c0102baa:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c0102baf:	e9 c9 fa ff ff       	jmp    c010267d <__alltraps>

c0102bb4 <vector141>:
.globl vector141
vector141:
  pushl $0
c0102bb4:	6a 00                	push   $0x0
  pushl $141
c0102bb6:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c0102bbb:	e9 bd fa ff ff       	jmp    c010267d <__alltraps>

c0102bc0 <vector142>:
.globl vector142
vector142:
  pushl $0
c0102bc0:	6a 00                	push   $0x0
  pushl $142
c0102bc2:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c0102bc7:	e9 b1 fa ff ff       	jmp    c010267d <__alltraps>

c0102bcc <vector143>:
.globl vector143
vector143:
  pushl $0
c0102bcc:	6a 00                	push   $0x0
  pushl $143
c0102bce:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c0102bd3:	e9 a5 fa ff ff       	jmp    c010267d <__alltraps>

c0102bd8 <vector144>:
.globl vector144
vector144:
  pushl $0
c0102bd8:	6a 00                	push   $0x0
  pushl $144
c0102bda:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c0102bdf:	e9 99 fa ff ff       	jmp    c010267d <__alltraps>

c0102be4 <vector145>:
.globl vector145
vector145:
  pushl $0
c0102be4:	6a 00                	push   $0x0
  pushl $145
c0102be6:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c0102beb:	e9 8d fa ff ff       	jmp    c010267d <__alltraps>

c0102bf0 <vector146>:
.globl vector146
vector146:
  pushl $0
c0102bf0:	6a 00                	push   $0x0
  pushl $146
c0102bf2:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c0102bf7:	e9 81 fa ff ff       	jmp    c010267d <__alltraps>

c0102bfc <vector147>:
.globl vector147
vector147:
  pushl $0
c0102bfc:	6a 00                	push   $0x0
  pushl $147
c0102bfe:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c0102c03:	e9 75 fa ff ff       	jmp    c010267d <__alltraps>

c0102c08 <vector148>:
.globl vector148
vector148:
  pushl $0
c0102c08:	6a 00                	push   $0x0
  pushl $148
c0102c0a:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c0102c0f:	e9 69 fa ff ff       	jmp    c010267d <__alltraps>

c0102c14 <vector149>:
.globl vector149
vector149:
  pushl $0
c0102c14:	6a 00                	push   $0x0
  pushl $149
c0102c16:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c0102c1b:	e9 5d fa ff ff       	jmp    c010267d <__alltraps>

c0102c20 <vector150>:
.globl vector150
vector150:
  pushl $0
c0102c20:	6a 00                	push   $0x0
  pushl $150
c0102c22:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c0102c27:	e9 51 fa ff ff       	jmp    c010267d <__alltraps>

c0102c2c <vector151>:
.globl vector151
vector151:
  pushl $0
c0102c2c:	6a 00                	push   $0x0
  pushl $151
c0102c2e:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0102c33:	e9 45 fa ff ff       	jmp    c010267d <__alltraps>

c0102c38 <vector152>:
.globl vector152
vector152:
  pushl $0
c0102c38:	6a 00                	push   $0x0
  pushl $152
c0102c3a:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0102c3f:	e9 39 fa ff ff       	jmp    c010267d <__alltraps>

c0102c44 <vector153>:
.globl vector153
vector153:
  pushl $0
c0102c44:	6a 00                	push   $0x0
  pushl $153
c0102c46:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c0102c4b:	e9 2d fa ff ff       	jmp    c010267d <__alltraps>

c0102c50 <vector154>:
.globl vector154
vector154:
  pushl $0
c0102c50:	6a 00                	push   $0x0
  pushl $154
c0102c52:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c0102c57:	e9 21 fa ff ff       	jmp    c010267d <__alltraps>

c0102c5c <vector155>:
.globl vector155
vector155:
  pushl $0
c0102c5c:	6a 00                	push   $0x0
  pushl $155
c0102c5e:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0102c63:	e9 15 fa ff ff       	jmp    c010267d <__alltraps>

c0102c68 <vector156>:
.globl vector156
vector156:
  pushl $0
c0102c68:	6a 00                	push   $0x0
  pushl $156
c0102c6a:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0102c6f:	e9 09 fa ff ff       	jmp    c010267d <__alltraps>

c0102c74 <vector157>:
.globl vector157
vector157:
  pushl $0
c0102c74:	6a 00                	push   $0x0
  pushl $157
c0102c76:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c0102c7b:	e9 fd f9 ff ff       	jmp    c010267d <__alltraps>

c0102c80 <vector158>:
.globl vector158
vector158:
  pushl $0
c0102c80:	6a 00                	push   $0x0
  pushl $158
c0102c82:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c0102c87:	e9 f1 f9 ff ff       	jmp    c010267d <__alltraps>

c0102c8c <vector159>:
.globl vector159
vector159:
  pushl $0
c0102c8c:	6a 00                	push   $0x0
  pushl $159
c0102c8e:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0102c93:	e9 e5 f9 ff ff       	jmp    c010267d <__alltraps>

c0102c98 <vector160>:
.globl vector160
vector160:
  pushl $0
c0102c98:	6a 00                	push   $0x0
  pushl $160
c0102c9a:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c0102c9f:	e9 d9 f9 ff ff       	jmp    c010267d <__alltraps>

c0102ca4 <vector161>:
.globl vector161
vector161:
  pushl $0
c0102ca4:	6a 00                	push   $0x0
  pushl $161
c0102ca6:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c0102cab:	e9 cd f9 ff ff       	jmp    c010267d <__alltraps>

c0102cb0 <vector162>:
.globl vector162
vector162:
  pushl $0
c0102cb0:	6a 00                	push   $0x0
  pushl $162
c0102cb2:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c0102cb7:	e9 c1 f9 ff ff       	jmp    c010267d <__alltraps>

c0102cbc <vector163>:
.globl vector163
vector163:
  pushl $0
c0102cbc:	6a 00                	push   $0x0
  pushl $163
c0102cbe:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c0102cc3:	e9 b5 f9 ff ff       	jmp    c010267d <__alltraps>

c0102cc8 <vector164>:
.globl vector164
vector164:
  pushl $0
c0102cc8:	6a 00                	push   $0x0
  pushl $164
c0102cca:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c0102ccf:	e9 a9 f9 ff ff       	jmp    c010267d <__alltraps>

c0102cd4 <vector165>:
.globl vector165
vector165:
  pushl $0
c0102cd4:	6a 00                	push   $0x0
  pushl $165
c0102cd6:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c0102cdb:	e9 9d f9 ff ff       	jmp    c010267d <__alltraps>

c0102ce0 <vector166>:
.globl vector166
vector166:
  pushl $0
c0102ce0:	6a 00                	push   $0x0
  pushl $166
c0102ce2:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c0102ce7:	e9 91 f9 ff ff       	jmp    c010267d <__alltraps>

c0102cec <vector167>:
.globl vector167
vector167:
  pushl $0
c0102cec:	6a 00                	push   $0x0
  pushl $167
c0102cee:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c0102cf3:	e9 85 f9 ff ff       	jmp    c010267d <__alltraps>

c0102cf8 <vector168>:
.globl vector168
vector168:
  pushl $0
c0102cf8:	6a 00                	push   $0x0
  pushl $168
c0102cfa:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c0102cff:	e9 79 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d04 <vector169>:
.globl vector169
vector169:
  pushl $0
c0102d04:	6a 00                	push   $0x0
  pushl $169
c0102d06:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c0102d0b:	e9 6d f9 ff ff       	jmp    c010267d <__alltraps>

c0102d10 <vector170>:
.globl vector170
vector170:
  pushl $0
c0102d10:	6a 00                	push   $0x0
  pushl $170
c0102d12:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c0102d17:	e9 61 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d1c <vector171>:
.globl vector171
vector171:
  pushl $0
c0102d1c:	6a 00                	push   $0x0
  pushl $171
c0102d1e:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c0102d23:	e9 55 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d28 <vector172>:
.globl vector172
vector172:
  pushl $0
c0102d28:	6a 00                	push   $0x0
  pushl $172
c0102d2a:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0102d2f:	e9 49 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d34 <vector173>:
.globl vector173
vector173:
  pushl $0
c0102d34:	6a 00                	push   $0x0
  pushl $173
c0102d36:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c0102d3b:	e9 3d f9 ff ff       	jmp    c010267d <__alltraps>

c0102d40 <vector174>:
.globl vector174
vector174:
  pushl $0
c0102d40:	6a 00                	push   $0x0
  pushl $174
c0102d42:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c0102d47:	e9 31 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d4c <vector175>:
.globl vector175
vector175:
  pushl $0
c0102d4c:	6a 00                	push   $0x0
  pushl $175
c0102d4e:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0102d53:	e9 25 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d58 <vector176>:
.globl vector176
vector176:
  pushl $0
c0102d58:	6a 00                	push   $0x0
  pushl $176
c0102d5a:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0102d5f:	e9 19 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d64 <vector177>:
.globl vector177
vector177:
  pushl $0
c0102d64:	6a 00                	push   $0x0
  pushl $177
c0102d66:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c0102d6b:	e9 0d f9 ff ff       	jmp    c010267d <__alltraps>

c0102d70 <vector178>:
.globl vector178
vector178:
  pushl $0
c0102d70:	6a 00                	push   $0x0
  pushl $178
c0102d72:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c0102d77:	e9 01 f9 ff ff       	jmp    c010267d <__alltraps>

c0102d7c <vector179>:
.globl vector179
vector179:
  pushl $0
c0102d7c:	6a 00                	push   $0x0
  pushl $179
c0102d7e:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0102d83:	e9 f5 f8 ff ff       	jmp    c010267d <__alltraps>

c0102d88 <vector180>:
.globl vector180
vector180:
  pushl $0
c0102d88:	6a 00                	push   $0x0
  pushl $180
c0102d8a:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0102d8f:	e9 e9 f8 ff ff       	jmp    c010267d <__alltraps>

c0102d94 <vector181>:
.globl vector181
vector181:
  pushl $0
c0102d94:	6a 00                	push   $0x0
  pushl $181
c0102d96:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c0102d9b:	e9 dd f8 ff ff       	jmp    c010267d <__alltraps>

c0102da0 <vector182>:
.globl vector182
vector182:
  pushl $0
c0102da0:	6a 00                	push   $0x0
  pushl $182
c0102da2:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c0102da7:	e9 d1 f8 ff ff       	jmp    c010267d <__alltraps>

c0102dac <vector183>:
.globl vector183
vector183:
  pushl $0
c0102dac:	6a 00                	push   $0x0
  pushl $183
c0102dae:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c0102db3:	e9 c5 f8 ff ff       	jmp    c010267d <__alltraps>

c0102db8 <vector184>:
.globl vector184
vector184:
  pushl $0
c0102db8:	6a 00                	push   $0x0
  pushl $184
c0102dba:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c0102dbf:	e9 b9 f8 ff ff       	jmp    c010267d <__alltraps>

c0102dc4 <vector185>:
.globl vector185
vector185:
  pushl $0
c0102dc4:	6a 00                	push   $0x0
  pushl $185
c0102dc6:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c0102dcb:	e9 ad f8 ff ff       	jmp    c010267d <__alltraps>

c0102dd0 <vector186>:
.globl vector186
vector186:
  pushl $0
c0102dd0:	6a 00                	push   $0x0
  pushl $186
c0102dd2:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c0102dd7:	e9 a1 f8 ff ff       	jmp    c010267d <__alltraps>

c0102ddc <vector187>:
.globl vector187
vector187:
  pushl $0
c0102ddc:	6a 00                	push   $0x0
  pushl $187
c0102dde:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c0102de3:	e9 95 f8 ff ff       	jmp    c010267d <__alltraps>

c0102de8 <vector188>:
.globl vector188
vector188:
  pushl $0
c0102de8:	6a 00                	push   $0x0
  pushl $188
c0102dea:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c0102def:	e9 89 f8 ff ff       	jmp    c010267d <__alltraps>

c0102df4 <vector189>:
.globl vector189
vector189:
  pushl $0
c0102df4:	6a 00                	push   $0x0
  pushl $189
c0102df6:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c0102dfb:	e9 7d f8 ff ff       	jmp    c010267d <__alltraps>

c0102e00 <vector190>:
.globl vector190
vector190:
  pushl $0
c0102e00:	6a 00                	push   $0x0
  pushl $190
c0102e02:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c0102e07:	e9 71 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e0c <vector191>:
.globl vector191
vector191:
  pushl $0
c0102e0c:	6a 00                	push   $0x0
  pushl $191
c0102e0e:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c0102e13:	e9 65 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e18 <vector192>:
.globl vector192
vector192:
  pushl $0
c0102e18:	6a 00                	push   $0x0
  pushl $192
c0102e1a:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c0102e1f:	e9 59 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e24 <vector193>:
.globl vector193
vector193:
  pushl $0
c0102e24:	6a 00                	push   $0x0
  pushl $193
c0102e26:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c0102e2b:	e9 4d f8 ff ff       	jmp    c010267d <__alltraps>

c0102e30 <vector194>:
.globl vector194
vector194:
  pushl $0
c0102e30:	6a 00                	push   $0x0
  pushl $194
c0102e32:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c0102e37:	e9 41 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e3c <vector195>:
.globl vector195
vector195:
  pushl $0
c0102e3c:	6a 00                	push   $0x0
  pushl $195
c0102e3e:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c0102e43:	e9 35 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e48 <vector196>:
.globl vector196
vector196:
  pushl $0
c0102e48:	6a 00                	push   $0x0
  pushl $196
c0102e4a:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0102e4f:	e9 29 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e54 <vector197>:
.globl vector197
vector197:
  pushl $0
c0102e54:	6a 00                	push   $0x0
  pushl $197
c0102e56:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c0102e5b:	e9 1d f8 ff ff       	jmp    c010267d <__alltraps>

c0102e60 <vector198>:
.globl vector198
vector198:
  pushl $0
c0102e60:	6a 00                	push   $0x0
  pushl $198
c0102e62:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c0102e67:	e9 11 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e6c <vector199>:
.globl vector199
vector199:
  pushl $0
c0102e6c:	6a 00                	push   $0x0
  pushl $199
c0102e6e:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c0102e73:	e9 05 f8 ff ff       	jmp    c010267d <__alltraps>

c0102e78 <vector200>:
.globl vector200
vector200:
  pushl $0
c0102e78:	6a 00                	push   $0x0
  pushl $200
c0102e7a:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0102e7f:	e9 f9 f7 ff ff       	jmp    c010267d <__alltraps>

c0102e84 <vector201>:
.globl vector201
vector201:
  pushl $0
c0102e84:	6a 00                	push   $0x0
  pushl $201
c0102e86:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c0102e8b:	e9 ed f7 ff ff       	jmp    c010267d <__alltraps>

c0102e90 <vector202>:
.globl vector202
vector202:
  pushl $0
c0102e90:	6a 00                	push   $0x0
  pushl $202
c0102e92:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c0102e97:	e9 e1 f7 ff ff       	jmp    c010267d <__alltraps>

c0102e9c <vector203>:
.globl vector203
vector203:
  pushl $0
c0102e9c:	6a 00                	push   $0x0
  pushl $203
c0102e9e:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c0102ea3:	e9 d5 f7 ff ff       	jmp    c010267d <__alltraps>

c0102ea8 <vector204>:
.globl vector204
vector204:
  pushl $0
c0102ea8:	6a 00                	push   $0x0
  pushl $204
c0102eaa:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c0102eaf:	e9 c9 f7 ff ff       	jmp    c010267d <__alltraps>

c0102eb4 <vector205>:
.globl vector205
vector205:
  pushl $0
c0102eb4:	6a 00                	push   $0x0
  pushl $205
c0102eb6:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c0102ebb:	e9 bd f7 ff ff       	jmp    c010267d <__alltraps>

c0102ec0 <vector206>:
.globl vector206
vector206:
  pushl $0
c0102ec0:	6a 00                	push   $0x0
  pushl $206
c0102ec2:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c0102ec7:	e9 b1 f7 ff ff       	jmp    c010267d <__alltraps>

c0102ecc <vector207>:
.globl vector207
vector207:
  pushl $0
c0102ecc:	6a 00                	push   $0x0
  pushl $207
c0102ece:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c0102ed3:	e9 a5 f7 ff ff       	jmp    c010267d <__alltraps>

c0102ed8 <vector208>:
.globl vector208
vector208:
  pushl $0
c0102ed8:	6a 00                	push   $0x0
  pushl $208
c0102eda:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c0102edf:	e9 99 f7 ff ff       	jmp    c010267d <__alltraps>

c0102ee4 <vector209>:
.globl vector209
vector209:
  pushl $0
c0102ee4:	6a 00                	push   $0x0
  pushl $209
c0102ee6:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c0102eeb:	e9 8d f7 ff ff       	jmp    c010267d <__alltraps>

c0102ef0 <vector210>:
.globl vector210
vector210:
  pushl $0
c0102ef0:	6a 00                	push   $0x0
  pushl $210
c0102ef2:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c0102ef7:	e9 81 f7 ff ff       	jmp    c010267d <__alltraps>

c0102efc <vector211>:
.globl vector211
vector211:
  pushl $0
c0102efc:	6a 00                	push   $0x0
  pushl $211
c0102efe:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c0102f03:	e9 75 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f08 <vector212>:
.globl vector212
vector212:
  pushl $0
c0102f08:	6a 00                	push   $0x0
  pushl $212
c0102f0a:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c0102f0f:	e9 69 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f14 <vector213>:
.globl vector213
vector213:
  pushl $0
c0102f14:	6a 00                	push   $0x0
  pushl $213
c0102f16:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c0102f1b:	e9 5d f7 ff ff       	jmp    c010267d <__alltraps>

c0102f20 <vector214>:
.globl vector214
vector214:
  pushl $0
c0102f20:	6a 00                	push   $0x0
  pushl $214
c0102f22:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c0102f27:	e9 51 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f2c <vector215>:
.globl vector215
vector215:
  pushl $0
c0102f2c:	6a 00                	push   $0x0
  pushl $215
c0102f2e:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c0102f33:	e9 45 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f38 <vector216>:
.globl vector216
vector216:
  pushl $0
c0102f38:	6a 00                	push   $0x0
  pushl $216
c0102f3a:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0102f3f:	e9 39 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f44 <vector217>:
.globl vector217
vector217:
  pushl $0
c0102f44:	6a 00                	push   $0x0
  pushl $217
c0102f46:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c0102f4b:	e9 2d f7 ff ff       	jmp    c010267d <__alltraps>

c0102f50 <vector218>:
.globl vector218
vector218:
  pushl $0
c0102f50:	6a 00                	push   $0x0
  pushl $218
c0102f52:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c0102f57:	e9 21 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f5c <vector219>:
.globl vector219
vector219:
  pushl $0
c0102f5c:	6a 00                	push   $0x0
  pushl $219
c0102f5e:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c0102f63:	e9 15 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f68 <vector220>:
.globl vector220
vector220:
  pushl $0
c0102f68:	6a 00                	push   $0x0
  pushl $220
c0102f6a:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0102f6f:	e9 09 f7 ff ff       	jmp    c010267d <__alltraps>

c0102f74 <vector221>:
.globl vector221
vector221:
  pushl $0
c0102f74:	6a 00                	push   $0x0
  pushl $221
c0102f76:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c0102f7b:	e9 fd f6 ff ff       	jmp    c010267d <__alltraps>

c0102f80 <vector222>:
.globl vector222
vector222:
  pushl $0
c0102f80:	6a 00                	push   $0x0
  pushl $222
c0102f82:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c0102f87:	e9 f1 f6 ff ff       	jmp    c010267d <__alltraps>

c0102f8c <vector223>:
.globl vector223
vector223:
  pushl $0
c0102f8c:	6a 00                	push   $0x0
  pushl $223
c0102f8e:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c0102f93:	e9 e5 f6 ff ff       	jmp    c010267d <__alltraps>

c0102f98 <vector224>:
.globl vector224
vector224:
  pushl $0
c0102f98:	6a 00                	push   $0x0
  pushl $224
c0102f9a:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c0102f9f:	e9 d9 f6 ff ff       	jmp    c010267d <__alltraps>

c0102fa4 <vector225>:
.globl vector225
vector225:
  pushl $0
c0102fa4:	6a 00                	push   $0x0
  pushl $225
c0102fa6:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c0102fab:	e9 cd f6 ff ff       	jmp    c010267d <__alltraps>

c0102fb0 <vector226>:
.globl vector226
vector226:
  pushl $0
c0102fb0:	6a 00                	push   $0x0
  pushl $226
c0102fb2:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c0102fb7:	e9 c1 f6 ff ff       	jmp    c010267d <__alltraps>

c0102fbc <vector227>:
.globl vector227
vector227:
  pushl $0
c0102fbc:	6a 00                	push   $0x0
  pushl $227
c0102fbe:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c0102fc3:	e9 b5 f6 ff ff       	jmp    c010267d <__alltraps>

c0102fc8 <vector228>:
.globl vector228
vector228:
  pushl $0
c0102fc8:	6a 00                	push   $0x0
  pushl $228
c0102fca:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c0102fcf:	e9 a9 f6 ff ff       	jmp    c010267d <__alltraps>

c0102fd4 <vector229>:
.globl vector229
vector229:
  pushl $0
c0102fd4:	6a 00                	push   $0x0
  pushl $229
c0102fd6:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c0102fdb:	e9 9d f6 ff ff       	jmp    c010267d <__alltraps>

c0102fe0 <vector230>:
.globl vector230
vector230:
  pushl $0
c0102fe0:	6a 00                	push   $0x0
  pushl $230
c0102fe2:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c0102fe7:	e9 91 f6 ff ff       	jmp    c010267d <__alltraps>

c0102fec <vector231>:
.globl vector231
vector231:
  pushl $0
c0102fec:	6a 00                	push   $0x0
  pushl $231
c0102fee:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c0102ff3:	e9 85 f6 ff ff       	jmp    c010267d <__alltraps>

c0102ff8 <vector232>:
.globl vector232
vector232:
  pushl $0
c0102ff8:	6a 00                	push   $0x0
  pushl $232
c0102ffa:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c0102fff:	e9 79 f6 ff ff       	jmp    c010267d <__alltraps>

c0103004 <vector233>:
.globl vector233
vector233:
  pushl $0
c0103004:	6a 00                	push   $0x0
  pushl $233
c0103006:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c010300b:	e9 6d f6 ff ff       	jmp    c010267d <__alltraps>

c0103010 <vector234>:
.globl vector234
vector234:
  pushl $0
c0103010:	6a 00                	push   $0x0
  pushl $234
c0103012:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c0103017:	e9 61 f6 ff ff       	jmp    c010267d <__alltraps>

c010301c <vector235>:
.globl vector235
vector235:
  pushl $0
c010301c:	6a 00                	push   $0x0
  pushl $235
c010301e:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c0103023:	e9 55 f6 ff ff       	jmp    c010267d <__alltraps>

c0103028 <vector236>:
.globl vector236
vector236:
  pushl $0
c0103028:	6a 00                	push   $0x0
  pushl $236
c010302a:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c010302f:	e9 49 f6 ff ff       	jmp    c010267d <__alltraps>

c0103034 <vector237>:
.globl vector237
vector237:
  pushl $0
c0103034:	6a 00                	push   $0x0
  pushl $237
c0103036:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c010303b:	e9 3d f6 ff ff       	jmp    c010267d <__alltraps>

c0103040 <vector238>:
.globl vector238
vector238:
  pushl $0
c0103040:	6a 00                	push   $0x0
  pushl $238
c0103042:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c0103047:	e9 31 f6 ff ff       	jmp    c010267d <__alltraps>

c010304c <vector239>:
.globl vector239
vector239:
  pushl $0
c010304c:	6a 00                	push   $0x0
  pushl $239
c010304e:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c0103053:	e9 25 f6 ff ff       	jmp    c010267d <__alltraps>

c0103058 <vector240>:
.globl vector240
vector240:
  pushl $0
c0103058:	6a 00                	push   $0x0
  pushl $240
c010305a:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c010305f:	e9 19 f6 ff ff       	jmp    c010267d <__alltraps>

c0103064 <vector241>:
.globl vector241
vector241:
  pushl $0
c0103064:	6a 00                	push   $0x0
  pushl $241
c0103066:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c010306b:	e9 0d f6 ff ff       	jmp    c010267d <__alltraps>

c0103070 <vector242>:
.globl vector242
vector242:
  pushl $0
c0103070:	6a 00                	push   $0x0
  pushl $242
c0103072:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c0103077:	e9 01 f6 ff ff       	jmp    c010267d <__alltraps>

c010307c <vector243>:
.globl vector243
vector243:
  pushl $0
c010307c:	6a 00                	push   $0x0
  pushl $243
c010307e:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c0103083:	e9 f5 f5 ff ff       	jmp    c010267d <__alltraps>

c0103088 <vector244>:
.globl vector244
vector244:
  pushl $0
c0103088:	6a 00                	push   $0x0
  pushl $244
c010308a:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c010308f:	e9 e9 f5 ff ff       	jmp    c010267d <__alltraps>

c0103094 <vector245>:
.globl vector245
vector245:
  pushl $0
c0103094:	6a 00                	push   $0x0
  pushl $245
c0103096:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c010309b:	e9 dd f5 ff ff       	jmp    c010267d <__alltraps>

c01030a0 <vector246>:
.globl vector246
vector246:
  pushl $0
c01030a0:	6a 00                	push   $0x0
  pushl $246
c01030a2:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c01030a7:	e9 d1 f5 ff ff       	jmp    c010267d <__alltraps>

c01030ac <vector247>:
.globl vector247
vector247:
  pushl $0
c01030ac:	6a 00                	push   $0x0
  pushl $247
c01030ae:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c01030b3:	e9 c5 f5 ff ff       	jmp    c010267d <__alltraps>

c01030b8 <vector248>:
.globl vector248
vector248:
  pushl $0
c01030b8:	6a 00                	push   $0x0
  pushl $248
c01030ba:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c01030bf:	e9 b9 f5 ff ff       	jmp    c010267d <__alltraps>

c01030c4 <vector249>:
.globl vector249
vector249:
  pushl $0
c01030c4:	6a 00                	push   $0x0
  pushl $249
c01030c6:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c01030cb:	e9 ad f5 ff ff       	jmp    c010267d <__alltraps>

c01030d0 <vector250>:
.globl vector250
vector250:
  pushl $0
c01030d0:	6a 00                	push   $0x0
  pushl $250
c01030d2:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01030d7:	e9 a1 f5 ff ff       	jmp    c010267d <__alltraps>

c01030dc <vector251>:
.globl vector251
vector251:
  pushl $0
c01030dc:	6a 00                	push   $0x0
  pushl $251
c01030de:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c01030e3:	e9 95 f5 ff ff       	jmp    c010267d <__alltraps>

c01030e8 <vector252>:
.globl vector252
vector252:
  pushl $0
c01030e8:	6a 00                	push   $0x0
  pushl $252
c01030ea:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c01030ef:	e9 89 f5 ff ff       	jmp    c010267d <__alltraps>

c01030f4 <vector253>:
.globl vector253
vector253:
  pushl $0
c01030f4:	6a 00                	push   $0x0
  pushl $253
c01030f6:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c01030fb:	e9 7d f5 ff ff       	jmp    c010267d <__alltraps>

c0103100 <vector254>:
.globl vector254
vector254:
  pushl $0
c0103100:	6a 00                	push   $0x0
  pushl $254
c0103102:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c0103107:	e9 71 f5 ff ff       	jmp    c010267d <__alltraps>

c010310c <vector255>:
.globl vector255
vector255:
  pushl $0
c010310c:	6a 00                	push   $0x0
  pushl $255
c010310e:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c0103113:	e9 65 f5 ff ff       	jmp    c010267d <__alltraps>

c0103118 <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c0103118:	55                   	push   %ebp
c0103119:	89 e5                	mov    %esp,%ebp
    return page - pages;
c010311b:	8b 55 08             	mov    0x8(%ebp),%edx
c010311e:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c0103123:	29 c2                	sub    %eax,%edx
c0103125:	89 d0                	mov    %edx,%eax
c0103127:	c1 f8 05             	sar    $0x5,%eax
}
c010312a:	5d                   	pop    %ebp
c010312b:	c3                   	ret    

c010312c <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c010312c:	55                   	push   %ebp
c010312d:	89 e5                	mov    %esp,%ebp
c010312f:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0103132:	8b 45 08             	mov    0x8(%ebp),%eax
c0103135:	89 04 24             	mov    %eax,(%esp)
c0103138:	e8 db ff ff ff       	call   c0103118 <page2ppn>
c010313d:	c1 e0 0c             	shl    $0xc,%eax
}
c0103140:	c9                   	leave  
c0103141:	c3                   	ret    

c0103142 <page_ref>:
pde2page(pde_t pde) {
    return pa2page(PDE_ADDR(pde));
}

static inline int
page_ref(struct Page *page) {
c0103142:	55                   	push   %ebp
c0103143:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0103145:	8b 45 08             	mov    0x8(%ebp),%eax
c0103148:	8b 00                	mov    (%eax),%eax
}
c010314a:	5d                   	pop    %ebp
c010314b:	c3                   	ret    

c010314c <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c010314c:	55                   	push   %ebp
c010314d:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c010314f:	8b 45 08             	mov    0x8(%ebp),%eax
c0103152:	8b 55 0c             	mov    0xc(%ebp),%edx
c0103155:	89 10                	mov    %edx,(%eax)
}
c0103157:	5d                   	pop    %ebp
c0103158:	c3                   	ret    

c0103159 <default_init>:

#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
default_init(void) {
c0103159:	55                   	push   %ebp
c010315a:	89 e5                	mov    %esp,%ebp
c010315c:	83 ec 10             	sub    $0x10,%esp
c010315f:	c7 45 fc 18 7b 12 c0 	movl   $0xc0127b18,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0103166:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0103169:	8b 55 fc             	mov    -0x4(%ebp),%edx
c010316c:	89 50 04             	mov    %edx,0x4(%eax)
c010316f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0103172:	8b 50 04             	mov    0x4(%eax),%edx
c0103175:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0103178:	89 10                	mov    %edx,(%eax)
    list_init(&free_list);
    nr_free = 0;
c010317a:	c7 05 20 7b 12 c0 00 	movl   $0x0,0xc0127b20
c0103181:	00 00 00 
}
c0103184:	c9                   	leave  
c0103185:	c3                   	ret    

c0103186 <default_init_memmap>:

static void
default_init_memmap(struct Page *base, size_t n) {
c0103186:	55                   	push   %ebp
c0103187:	89 e5                	mov    %esp,%ebp
c0103189:	83 ec 48             	sub    $0x48,%esp
    assert(n > 0);
c010318c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0103190:	75 24                	jne    c01031b6 <default_init_memmap+0x30>
c0103192:	c7 44 24 0c f0 a3 10 	movl   $0xc010a3f0,0xc(%esp)
c0103199:	c0 
c010319a:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01031a1:	c0 
c01031a2:	c7 44 24 04 46 00 00 	movl   $0x46,0x4(%esp)
c01031a9:	00 
c01031aa:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01031b1:	e8 6d da ff ff       	call   c0100c23 <__panic>
    struct Page *p = base;
c01031b6:	8b 45 08             	mov    0x8(%ebp),%eax
c01031b9:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c01031bc:	e9 dc 00 00 00       	jmp    c010329d <default_init_memmap+0x117>
        assert(PageReserved(p));
c01031c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01031c4:	83 c0 04             	add    $0x4,%eax
c01031c7:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c01031ce:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01031d1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01031d4:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01031d7:	0f a3 10             	bt     %edx,(%eax)
c01031da:	19 c0                	sbb    %eax,%eax
c01031dc:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return oldbit != 0;
c01031df:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01031e3:	0f 95 c0             	setne  %al
c01031e6:	0f b6 c0             	movzbl %al,%eax
c01031e9:	85 c0                	test   %eax,%eax
c01031eb:	75 24                	jne    c0103211 <default_init_memmap+0x8b>
c01031ed:	c7 44 24 0c 21 a4 10 	movl   $0xc010a421,0xc(%esp)
c01031f4:	c0 
c01031f5:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01031fc:	c0 
c01031fd:	c7 44 24 04 49 00 00 	movl   $0x49,0x4(%esp)
c0103204:	00 
c0103205:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c010320c:	e8 12 da ff ff       	call   c0100c23 <__panic>
        p->flags = 0;
c0103211:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103214:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        SetPageProperty(p);
c010321b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010321e:	83 c0 04             	add    $0x4,%eax
c0103221:	c7 45 e4 01 00 00 00 	movl   $0x1,-0x1c(%ebp)
c0103228:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010322b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010322e:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0103231:	0f ab 10             	bts    %edx,(%eax)
        p->property = 0;
c0103234:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103237:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        set_page_ref(p, 0);
c010323e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0103245:	00 
c0103246:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103249:	89 04 24             	mov    %eax,(%esp)
c010324c:	e8 fb fe ff ff       	call   c010314c <set_page_ref>
        list_add_before(&free_list, &(p->page_link));
c0103251:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103254:	83 c0 0c             	add    $0xc,%eax
c0103257:	c7 45 dc 18 7b 12 c0 	movl   $0xc0127b18,-0x24(%ebp)
c010325e:	89 45 d8             	mov    %eax,-0x28(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c0103261:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103264:	8b 00                	mov    (%eax),%eax
c0103266:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0103269:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010326c:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010326f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103272:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0103275:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103278:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010327b:	89 10                	mov    %edx,(%eax)
c010327d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103280:	8b 10                	mov    (%eax),%edx
c0103282:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103285:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0103288:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010328b:	8b 55 cc             	mov    -0x34(%ebp),%edx
c010328e:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0103291:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103294:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103297:	89 10                	mov    %edx,(%eax)

static void
default_init_memmap(struct Page *base, size_t n) {
    assert(n > 0);
    struct Page *p = base;
    for (; p != base + n; p ++) {
c0103299:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c010329d:	8b 45 0c             	mov    0xc(%ebp),%eax
c01032a0:	c1 e0 05             	shl    $0x5,%eax
c01032a3:	89 c2                	mov    %eax,%edx
c01032a5:	8b 45 08             	mov    0x8(%ebp),%eax
c01032a8:	01 d0                	add    %edx,%eax
c01032aa:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01032ad:	0f 85 0e ff ff ff    	jne    c01031c1 <default_init_memmap+0x3b>
        SetPageProperty(p);
        p->property = 0;
        set_page_ref(p, 0);
        list_add_before(&free_list, &(p->page_link));
    }
    nr_free += n;
c01032b3:	8b 15 20 7b 12 c0    	mov    0xc0127b20,%edx
c01032b9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01032bc:	01 d0                	add    %edx,%eax
c01032be:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20
    //first block
    base->property = n;
c01032c3:	8b 45 08             	mov    0x8(%ebp),%eax
c01032c6:	8b 55 0c             	mov    0xc(%ebp),%edx
c01032c9:	89 50 08             	mov    %edx,0x8(%eax)
}
c01032cc:	c9                   	leave  
c01032cd:	c3                   	ret    

c01032ce <default_alloc_pages>:

static struct Page *
default_alloc_pages(size_t n) {
c01032ce:	55                   	push   %ebp
c01032cf:	89 e5                	mov    %esp,%ebp
c01032d1:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c01032d4:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01032d8:	75 24                	jne    c01032fe <default_alloc_pages+0x30>
c01032da:	c7 44 24 0c f0 a3 10 	movl   $0xc010a3f0,0xc(%esp)
c01032e1:	c0 
c01032e2:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01032e9:	c0 
c01032ea:	c7 44 24 04 57 00 00 	movl   $0x57,0x4(%esp)
c01032f1:	00 
c01032f2:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01032f9:	e8 25 d9 ff ff       	call   c0100c23 <__panic>
    if (n > nr_free) {
c01032fe:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0103303:	3b 45 08             	cmp    0x8(%ebp),%eax
c0103306:	73 0a                	jae    c0103312 <default_alloc_pages+0x44>
        return NULL;
c0103308:	b8 00 00 00 00       	mov    $0x0,%eax
c010330d:	e9 37 01 00 00       	jmp    c0103449 <default_alloc_pages+0x17b>
    }
    list_entry_t *le, *len;
    le = &free_list;
c0103312:	c7 45 f4 18 7b 12 c0 	movl   $0xc0127b18,-0xc(%ebp)

    while((le=list_next(le)) != &free_list) {
c0103319:	e9 0a 01 00 00       	jmp    c0103428 <default_alloc_pages+0x15a>
      struct Page *p = le2page(le, page_link);
c010331e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103321:	83 e8 0c             	sub    $0xc,%eax
c0103324:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(p->property >= n){
c0103327:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010332a:	8b 40 08             	mov    0x8(%eax),%eax
c010332d:	3b 45 08             	cmp    0x8(%ebp),%eax
c0103330:	0f 82 f2 00 00 00    	jb     c0103428 <default_alloc_pages+0x15a>
        int i;
        for(i=0;i<n;i++){
c0103336:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c010333d:	eb 7c                	jmp    c01033bb <default_alloc_pages+0xed>
c010333f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103342:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0103345:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103348:	8b 40 04             	mov    0x4(%eax),%eax
          len = list_next(le);
c010334b:	89 45 e8             	mov    %eax,-0x18(%ebp)
          struct Page *pp = le2page(le, page_link);
c010334e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103351:	83 e8 0c             	sub    $0xc,%eax
c0103354:	89 45 e4             	mov    %eax,-0x1c(%ebp)
          SetPageReserved(pp);
c0103357:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010335a:	83 c0 04             	add    $0x4,%eax
c010335d:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0103364:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0103367:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010336a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010336d:	0f ab 10             	bts    %edx,(%eax)
          ClearPageProperty(pp);
c0103370:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103373:	83 c0 04             	add    $0x4,%eax
c0103376:	c7 45 d4 01 00 00 00 	movl   $0x1,-0x2c(%ebp)
c010337d:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103380:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103383:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103386:	0f b3 10             	btr    %edx,(%eax)
c0103389:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010338c:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c010338f:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103392:	8b 40 04             	mov    0x4(%eax),%eax
c0103395:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0103398:	8b 12                	mov    (%edx),%edx
c010339a:	89 55 c8             	mov    %edx,-0x38(%ebp)
c010339d:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c01033a0:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01033a3:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01033a6:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01033a9:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01033ac:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01033af:	89 10                	mov    %edx,(%eax)
          list_del(le);
          le = len;
c01033b1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01033b4:	89 45 f4             	mov    %eax,-0xc(%ebp)

    while((le=list_next(le)) != &free_list) {
      struct Page *p = le2page(le, page_link);
      if(p->property >= n){
        int i;
        for(i=0;i<n;i++){
c01033b7:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
c01033bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01033be:	3b 45 08             	cmp    0x8(%ebp),%eax
c01033c1:	0f 82 78 ff ff ff    	jb     c010333f <default_alloc_pages+0x71>
          SetPageReserved(pp);
          ClearPageProperty(pp);
          list_del(le);
          le = len;
        }
        if(p->property>n){
c01033c7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01033ca:	8b 40 08             	mov    0x8(%eax),%eax
c01033cd:	3b 45 08             	cmp    0x8(%ebp),%eax
c01033d0:	76 12                	jbe    c01033e4 <default_alloc_pages+0x116>
          (le2page(le,page_link))->property = p->property - n;
c01033d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01033d5:	8d 50 f4             	lea    -0xc(%eax),%edx
c01033d8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01033db:	8b 40 08             	mov    0x8(%eax),%eax
c01033de:	2b 45 08             	sub    0x8(%ebp),%eax
c01033e1:	89 42 08             	mov    %eax,0x8(%edx)
        }
        ClearPageProperty(p);
c01033e4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01033e7:	83 c0 04             	add    $0x4,%eax
c01033ea:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c01033f1:	89 45 bc             	mov    %eax,-0x44(%ebp)
c01033f4:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01033f7:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01033fa:	0f b3 10             	btr    %edx,(%eax)
        SetPageReserved(p);
c01033fd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103400:	83 c0 04             	add    $0x4,%eax
c0103403:	c7 45 b8 00 00 00 00 	movl   $0x0,-0x48(%ebp)
c010340a:	89 45 b4             	mov    %eax,-0x4c(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c010340d:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103410:	8b 55 b8             	mov    -0x48(%ebp),%edx
c0103413:	0f ab 10             	bts    %edx,(%eax)
        nr_free -= n;
c0103416:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c010341b:	2b 45 08             	sub    0x8(%ebp),%eax
c010341e:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20
        return p;
c0103423:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103426:	eb 21                	jmp    c0103449 <default_alloc_pages+0x17b>
c0103428:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010342b:	89 45 b0             	mov    %eax,-0x50(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010342e:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103431:	8b 40 04             	mov    0x4(%eax),%eax
        return NULL;
    }
    list_entry_t *le, *len;
    le = &free_list;

    while((le=list_next(le)) != &free_list) {
c0103434:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103437:	81 7d f4 18 7b 12 c0 	cmpl   $0xc0127b18,-0xc(%ebp)
c010343e:	0f 85 da fe ff ff    	jne    c010331e <default_alloc_pages+0x50>
        SetPageReserved(p);
        nr_free -= n;
        return p;
      }
    }
    return NULL;
c0103444:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0103449:	c9                   	leave  
c010344a:	c3                   	ret    

c010344b <default_free_pages>:

static void
default_free_pages(struct Page *base, size_t n) {
c010344b:	55                   	push   %ebp
c010344c:	89 e5                	mov    %esp,%ebp
c010344e:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c0103451:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0103455:	75 24                	jne    c010347b <default_free_pages+0x30>
c0103457:	c7 44 24 0c f0 a3 10 	movl   $0xc010a3f0,0xc(%esp)
c010345e:	c0 
c010345f:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103466:	c0 
c0103467:	c7 44 24 04 78 00 00 	movl   $0x78,0x4(%esp)
c010346e:	00 
c010346f:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103476:	e8 a8 d7 ff ff       	call   c0100c23 <__panic>
    assert(PageReserved(base));
c010347b:	8b 45 08             	mov    0x8(%ebp),%eax
c010347e:	83 c0 04             	add    $0x4,%eax
c0103481:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0103488:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010348b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010348e:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0103491:	0f a3 10             	bt     %edx,(%eax)
c0103494:	19 c0                	sbb    %eax,%eax
c0103496:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c0103499:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010349d:	0f 95 c0             	setne  %al
c01034a0:	0f b6 c0             	movzbl %al,%eax
c01034a3:	85 c0                	test   %eax,%eax
c01034a5:	75 24                	jne    c01034cb <default_free_pages+0x80>
c01034a7:	c7 44 24 0c 31 a4 10 	movl   $0xc010a431,0xc(%esp)
c01034ae:	c0 
c01034af:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01034b6:	c0 
c01034b7:	c7 44 24 04 79 00 00 	movl   $0x79,0x4(%esp)
c01034be:	00 
c01034bf:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01034c6:	e8 58 d7 ff ff       	call   c0100c23 <__panic>

    list_entry_t *le = &free_list;
c01034cb:	c7 45 f4 18 7b 12 c0 	movl   $0xc0127b18,-0xc(%ebp)
    struct Page * p;
    while((le=list_next(le)) != &free_list) {
c01034d2:	eb 13                	jmp    c01034e7 <default_free_pages+0x9c>
      p = le2page(le, page_link);
c01034d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01034d7:	83 e8 0c             	sub    $0xc,%eax
c01034da:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(p>base){
c01034dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01034e0:	3b 45 08             	cmp    0x8(%ebp),%eax
c01034e3:	76 02                	jbe    c01034e7 <default_free_pages+0x9c>
        break;
c01034e5:	eb 18                	jmp    c01034ff <default_free_pages+0xb4>
c01034e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01034ea:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01034ed:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01034f0:	8b 40 04             	mov    0x4(%eax),%eax
    assert(n > 0);
    assert(PageReserved(base));

    list_entry_t *le = &free_list;
    struct Page * p;
    while((le=list_next(le)) != &free_list) {
c01034f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01034f6:	81 7d f4 18 7b 12 c0 	cmpl   $0xc0127b18,-0xc(%ebp)
c01034fd:	75 d5                	jne    c01034d4 <default_free_pages+0x89>
      if(p>base){
        break;
      }
    }
   //list_add_before(le, base->page_link);
    for(p=base;p<base+n;p++){
c01034ff:	8b 45 08             	mov    0x8(%ebp),%eax
c0103502:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103505:	eb 4b                	jmp    c0103552 <default_free_pages+0x107>
      list_add_before(le, &(p->page_link));
c0103507:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010350a:	8d 50 0c             	lea    0xc(%eax),%edx
c010350d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103510:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0103513:	89 55 d8             	mov    %edx,-0x28(%ebp)
 * Insert the new element @elm *before* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_before(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm->prev, listelm);
c0103516:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103519:	8b 00                	mov    (%eax),%eax
c010351b:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010351e:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0103521:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0103524:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103527:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c010352a:	8b 45 cc             	mov    -0x34(%ebp),%eax
c010352d:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103530:	89 10                	mov    %edx,(%eax)
c0103532:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103535:	8b 10                	mov    (%eax),%edx
c0103537:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010353a:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c010353d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103540:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0103543:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0103546:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103549:	8b 55 d0             	mov    -0x30(%ebp),%edx
c010354c:	89 10                	mov    %edx,(%eax)
      if(p>base){
        break;
      }
    }
   //list_add_before(le, base->page_link);
    for(p=base;p<base+n;p++){
c010354e:	83 45 f0 20          	addl   $0x20,-0x10(%ebp)
c0103552:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103555:	c1 e0 05             	shl    $0x5,%eax
c0103558:	89 c2                	mov    %eax,%edx
c010355a:	8b 45 08             	mov    0x8(%ebp),%eax
c010355d:	01 d0                	add    %edx,%eax
c010355f:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0103562:	77 a3                	ja     c0103507 <default_free_pages+0xbc>
      list_add_before(le, &(p->page_link));
    }
    base->flags = 0;
c0103564:	8b 45 08             	mov    0x8(%ebp),%eax
c0103567:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    set_page_ref(base, 0);
c010356e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0103575:	00 
c0103576:	8b 45 08             	mov    0x8(%ebp),%eax
c0103579:	89 04 24             	mov    %eax,(%esp)
c010357c:	e8 cb fb ff ff       	call   c010314c <set_page_ref>
    ClearPageProperty(base);
c0103581:	8b 45 08             	mov    0x8(%ebp),%eax
c0103584:	83 c0 04             	add    $0x4,%eax
c0103587:	c7 45 c8 01 00 00 00 	movl   $0x1,-0x38(%ebp)
c010358e:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * @nr:     the bit to clear
 * @addr:   the address to start counting from
 * */
static inline void
clear_bit(int nr, volatile void *addr) {
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0103591:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103594:	8b 55 c8             	mov    -0x38(%ebp),%edx
c0103597:	0f b3 10             	btr    %edx,(%eax)
    SetPageProperty(base);
c010359a:	8b 45 08             	mov    0x8(%ebp),%eax
c010359d:	83 c0 04             	add    $0x4,%eax
c01035a0:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c01035a7:	89 45 bc             	mov    %eax,-0x44(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01035aa:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01035ad:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01035b0:	0f ab 10             	bts    %edx,(%eax)
    base->property = n;
c01035b3:	8b 45 08             	mov    0x8(%ebp),%eax
c01035b6:	8b 55 0c             	mov    0xc(%ebp),%edx
c01035b9:	89 50 08             	mov    %edx,0x8(%eax)
    
    p = le2page(le,page_link) ;
c01035bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01035bf:	83 e8 0c             	sub    $0xc,%eax
c01035c2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if( base+n == p ){
c01035c5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01035c8:	c1 e0 05             	shl    $0x5,%eax
c01035cb:	89 c2                	mov    %eax,%edx
c01035cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01035d0:	01 d0                	add    %edx,%eax
c01035d2:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01035d5:	75 1e                	jne    c01035f5 <default_free_pages+0x1aa>
      base->property += p->property;
c01035d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01035da:	8b 50 08             	mov    0x8(%eax),%edx
c01035dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01035e0:	8b 40 08             	mov    0x8(%eax),%eax
c01035e3:	01 c2                	add    %eax,%edx
c01035e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01035e8:	89 50 08             	mov    %edx,0x8(%eax)
      p->property = 0;
c01035eb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01035ee:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
    }
    le = list_prev(&(base->page_link));
c01035f5:	8b 45 08             	mov    0x8(%ebp),%eax
c01035f8:	83 c0 0c             	add    $0xc,%eax
c01035fb:	89 45 b8             	mov    %eax,-0x48(%ebp)
 * list_prev - get the previous entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_prev(list_entry_t *listelm) {
    return listelm->prev;
c01035fe:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0103601:	8b 00                	mov    (%eax),%eax
c0103603:	89 45 f4             	mov    %eax,-0xc(%ebp)
    p = le2page(le, page_link);
c0103606:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103609:	83 e8 0c             	sub    $0xc,%eax
c010360c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(le!=&free_list && p==base-1){
c010360f:	81 7d f4 18 7b 12 c0 	cmpl   $0xc0127b18,-0xc(%ebp)
c0103616:	74 57                	je     c010366f <default_free_pages+0x224>
c0103618:	8b 45 08             	mov    0x8(%ebp),%eax
c010361b:	83 e8 20             	sub    $0x20,%eax
c010361e:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0103621:	75 4c                	jne    c010366f <default_free_pages+0x224>
      while(le!=&free_list){
c0103623:	eb 41                	jmp    c0103666 <default_free_pages+0x21b>
        if(p->property){
c0103625:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103628:	8b 40 08             	mov    0x8(%eax),%eax
c010362b:	85 c0                	test   %eax,%eax
c010362d:	74 20                	je     c010364f <default_free_pages+0x204>
          p->property += base->property;
c010362f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103632:	8b 50 08             	mov    0x8(%eax),%edx
c0103635:	8b 45 08             	mov    0x8(%ebp),%eax
c0103638:	8b 40 08             	mov    0x8(%eax),%eax
c010363b:	01 c2                	add    %eax,%edx
c010363d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103640:	89 50 08             	mov    %edx,0x8(%eax)
          base->property = 0;
c0103643:	8b 45 08             	mov    0x8(%ebp),%eax
c0103646:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
          break;
c010364d:	eb 20                	jmp    c010366f <default_free_pages+0x224>
c010364f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103652:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0103655:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103658:	8b 00                	mov    (%eax),%eax
        }
        le = list_prev(le);
c010365a:	89 45 f4             	mov    %eax,-0xc(%ebp)
        p = le2page(le,page_link);
c010365d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103660:	83 e8 0c             	sub    $0xc,%eax
c0103663:	89 45 f0             	mov    %eax,-0x10(%ebp)
      p->property = 0;
    }
    le = list_prev(&(base->page_link));
    p = le2page(le, page_link);
    if(le!=&free_list && p==base-1){
      while(le!=&free_list){
c0103666:	81 7d f4 18 7b 12 c0 	cmpl   $0xc0127b18,-0xc(%ebp)
c010366d:	75 b6                	jne    c0103625 <default_free_pages+0x1da>
        le = list_prev(le);
        p = le2page(le,page_link);
      }
    }

    nr_free += n;
c010366f:	8b 15 20 7b 12 c0    	mov    0xc0127b20,%edx
c0103675:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103678:	01 d0                	add    %edx,%eax
c010367a:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20
    return ;
c010367f:	90                   	nop
}
c0103680:	c9                   	leave  
c0103681:	c3                   	ret    

c0103682 <default_nr_free_pages>:

static size_t
default_nr_free_pages(void) {
c0103682:	55                   	push   %ebp
c0103683:	89 e5                	mov    %esp,%ebp
    return nr_free;
c0103685:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
}
c010368a:	5d                   	pop    %ebp
c010368b:	c3                   	ret    

c010368c <basic_check>:

static void
basic_check(void) {
c010368c:	55                   	push   %ebp
c010368d:	89 e5                	mov    %esp,%ebp
c010368f:	83 ec 48             	sub    $0x48,%esp
    struct Page *p0, *p1, *p2;
    p0 = p1 = p2 = NULL;
c0103692:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0103699:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010369c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010369f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01036a2:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert((p0 = alloc_page()) != NULL);
c01036a5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01036ac:	e8 c4 15 00 00       	call   c0104c75 <alloc_pages>
c01036b1:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01036b4:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c01036b8:	75 24                	jne    c01036de <basic_check+0x52>
c01036ba:	c7 44 24 0c 44 a4 10 	movl   $0xc010a444,0xc(%esp)
c01036c1:	c0 
c01036c2:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01036c9:	c0 
c01036ca:	c7 44 24 04 ad 00 00 	movl   $0xad,0x4(%esp)
c01036d1:	00 
c01036d2:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01036d9:	e8 45 d5 ff ff       	call   c0100c23 <__panic>
    assert((p1 = alloc_page()) != NULL);
c01036de:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01036e5:	e8 8b 15 00 00       	call   c0104c75 <alloc_pages>
c01036ea:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01036ed:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01036f1:	75 24                	jne    c0103717 <basic_check+0x8b>
c01036f3:	c7 44 24 0c 60 a4 10 	movl   $0xc010a460,0xc(%esp)
c01036fa:	c0 
c01036fb:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103702:	c0 
c0103703:	c7 44 24 04 ae 00 00 	movl   $0xae,0x4(%esp)
c010370a:	00 
c010370b:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103712:	e8 0c d5 ff ff       	call   c0100c23 <__panic>
    assert((p2 = alloc_page()) != NULL);
c0103717:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010371e:	e8 52 15 00 00       	call   c0104c75 <alloc_pages>
c0103723:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103726:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010372a:	75 24                	jne    c0103750 <basic_check+0xc4>
c010372c:	c7 44 24 0c 7c a4 10 	movl   $0xc010a47c,0xc(%esp)
c0103733:	c0 
c0103734:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c010373b:	c0 
c010373c:	c7 44 24 04 af 00 00 	movl   $0xaf,0x4(%esp)
c0103743:	00 
c0103744:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c010374b:	e8 d3 d4 ff ff       	call   c0100c23 <__panic>

    assert(p0 != p1 && p0 != p2 && p1 != p2);
c0103750:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103753:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0103756:	74 10                	je     c0103768 <basic_check+0xdc>
c0103758:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010375b:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010375e:	74 08                	je     c0103768 <basic_check+0xdc>
c0103760:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103763:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0103766:	75 24                	jne    c010378c <basic_check+0x100>
c0103768:	c7 44 24 0c 98 a4 10 	movl   $0xc010a498,0xc(%esp)
c010376f:	c0 
c0103770:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103777:	c0 
c0103778:	c7 44 24 04 b1 00 00 	movl   $0xb1,0x4(%esp)
c010377f:	00 
c0103780:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103787:	e8 97 d4 ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p0) == 0 && page_ref(p1) == 0 && page_ref(p2) == 0);
c010378c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010378f:	89 04 24             	mov    %eax,(%esp)
c0103792:	e8 ab f9 ff ff       	call   c0103142 <page_ref>
c0103797:	85 c0                	test   %eax,%eax
c0103799:	75 1e                	jne    c01037b9 <basic_check+0x12d>
c010379b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010379e:	89 04 24             	mov    %eax,(%esp)
c01037a1:	e8 9c f9 ff ff       	call   c0103142 <page_ref>
c01037a6:	85 c0                	test   %eax,%eax
c01037a8:	75 0f                	jne    c01037b9 <basic_check+0x12d>
c01037aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01037ad:	89 04 24             	mov    %eax,(%esp)
c01037b0:	e8 8d f9 ff ff       	call   c0103142 <page_ref>
c01037b5:	85 c0                	test   %eax,%eax
c01037b7:	74 24                	je     c01037dd <basic_check+0x151>
c01037b9:	c7 44 24 0c bc a4 10 	movl   $0xc010a4bc,0xc(%esp)
c01037c0:	c0 
c01037c1:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01037c8:	c0 
c01037c9:	c7 44 24 04 b2 00 00 	movl   $0xb2,0x4(%esp)
c01037d0:	00 
c01037d1:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01037d8:	e8 46 d4 ff ff       	call   c0100c23 <__panic>

    assert(page2pa(p0) < npage * PGSIZE);
c01037dd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01037e0:	89 04 24             	mov    %eax,(%esp)
c01037e3:	e8 44 f9 ff ff       	call   c010312c <page2pa>
c01037e8:	8b 15 40 5a 12 c0    	mov    0xc0125a40,%edx
c01037ee:	c1 e2 0c             	shl    $0xc,%edx
c01037f1:	39 d0                	cmp    %edx,%eax
c01037f3:	72 24                	jb     c0103819 <basic_check+0x18d>
c01037f5:	c7 44 24 0c f8 a4 10 	movl   $0xc010a4f8,0xc(%esp)
c01037fc:	c0 
c01037fd:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103804:	c0 
c0103805:	c7 44 24 04 b4 00 00 	movl   $0xb4,0x4(%esp)
c010380c:	00 
c010380d:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103814:	e8 0a d4 ff ff       	call   c0100c23 <__panic>
    assert(page2pa(p1) < npage * PGSIZE);
c0103819:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010381c:	89 04 24             	mov    %eax,(%esp)
c010381f:	e8 08 f9 ff ff       	call   c010312c <page2pa>
c0103824:	8b 15 40 5a 12 c0    	mov    0xc0125a40,%edx
c010382a:	c1 e2 0c             	shl    $0xc,%edx
c010382d:	39 d0                	cmp    %edx,%eax
c010382f:	72 24                	jb     c0103855 <basic_check+0x1c9>
c0103831:	c7 44 24 0c 15 a5 10 	movl   $0xc010a515,0xc(%esp)
c0103838:	c0 
c0103839:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103840:	c0 
c0103841:	c7 44 24 04 b5 00 00 	movl   $0xb5,0x4(%esp)
c0103848:	00 
c0103849:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103850:	e8 ce d3 ff ff       	call   c0100c23 <__panic>
    assert(page2pa(p2) < npage * PGSIZE);
c0103855:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103858:	89 04 24             	mov    %eax,(%esp)
c010385b:	e8 cc f8 ff ff       	call   c010312c <page2pa>
c0103860:	8b 15 40 5a 12 c0    	mov    0xc0125a40,%edx
c0103866:	c1 e2 0c             	shl    $0xc,%edx
c0103869:	39 d0                	cmp    %edx,%eax
c010386b:	72 24                	jb     c0103891 <basic_check+0x205>
c010386d:	c7 44 24 0c 32 a5 10 	movl   $0xc010a532,0xc(%esp)
c0103874:	c0 
c0103875:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c010387c:	c0 
c010387d:	c7 44 24 04 b6 00 00 	movl   $0xb6,0x4(%esp)
c0103884:	00 
c0103885:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c010388c:	e8 92 d3 ff ff       	call   c0100c23 <__panic>

    list_entry_t free_list_store = free_list;
c0103891:	a1 18 7b 12 c0       	mov    0xc0127b18,%eax
c0103896:	8b 15 1c 7b 12 c0    	mov    0xc0127b1c,%edx
c010389c:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010389f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01038a2:	c7 45 e0 18 7b 12 c0 	movl   $0xc0127b18,-0x20(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01038a9:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01038ac:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01038af:	89 50 04             	mov    %edx,0x4(%eax)
c01038b2:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01038b5:	8b 50 04             	mov    0x4(%eax),%edx
c01038b8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01038bb:	89 10                	mov    %edx,(%eax)
c01038bd:	c7 45 dc 18 7b 12 c0 	movl   $0xc0127b18,-0x24(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c01038c4:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01038c7:	8b 40 04             	mov    0x4(%eax),%eax
c01038ca:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c01038cd:	0f 94 c0             	sete   %al
c01038d0:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c01038d3:	85 c0                	test   %eax,%eax
c01038d5:	75 24                	jne    c01038fb <basic_check+0x26f>
c01038d7:	c7 44 24 0c 4f a5 10 	movl   $0xc010a54f,0xc(%esp)
c01038de:	c0 
c01038df:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01038e6:	c0 
c01038e7:	c7 44 24 04 ba 00 00 	movl   $0xba,0x4(%esp)
c01038ee:	00 
c01038ef:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01038f6:	e8 28 d3 ff ff       	call   c0100c23 <__panic>

    unsigned int nr_free_store = nr_free;
c01038fb:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0103900:	89 45 e8             	mov    %eax,-0x18(%ebp)
    nr_free = 0;
c0103903:	c7 05 20 7b 12 c0 00 	movl   $0x0,0xc0127b20
c010390a:	00 00 00 

    assert(alloc_page() == NULL);
c010390d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103914:	e8 5c 13 00 00       	call   c0104c75 <alloc_pages>
c0103919:	85 c0                	test   %eax,%eax
c010391b:	74 24                	je     c0103941 <basic_check+0x2b5>
c010391d:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c0103924:	c0 
c0103925:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c010392c:	c0 
c010392d:	c7 44 24 04 bf 00 00 	movl   $0xbf,0x4(%esp)
c0103934:	00 
c0103935:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c010393c:	e8 e2 d2 ff ff       	call   c0100c23 <__panic>

    free_page(p0);
c0103941:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103948:	00 
c0103949:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010394c:	89 04 24             	mov    %eax,(%esp)
c010394f:	e8 8c 13 00 00       	call   c0104ce0 <free_pages>
    free_page(p1);
c0103954:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010395b:	00 
c010395c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010395f:	89 04 24             	mov    %eax,(%esp)
c0103962:	e8 79 13 00 00       	call   c0104ce0 <free_pages>
    free_page(p2);
c0103967:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010396e:	00 
c010396f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103972:	89 04 24             	mov    %eax,(%esp)
c0103975:	e8 66 13 00 00       	call   c0104ce0 <free_pages>
    assert(nr_free == 3);
c010397a:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c010397f:	83 f8 03             	cmp    $0x3,%eax
c0103982:	74 24                	je     c01039a8 <basic_check+0x31c>
c0103984:	c7 44 24 0c 7b a5 10 	movl   $0xc010a57b,0xc(%esp)
c010398b:	c0 
c010398c:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103993:	c0 
c0103994:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c010399b:	00 
c010399c:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01039a3:	e8 7b d2 ff ff       	call   c0100c23 <__panic>

    assert((p0 = alloc_page()) != NULL);
c01039a8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01039af:	e8 c1 12 00 00       	call   c0104c75 <alloc_pages>
c01039b4:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01039b7:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c01039bb:	75 24                	jne    c01039e1 <basic_check+0x355>
c01039bd:	c7 44 24 0c 44 a4 10 	movl   $0xc010a444,0xc(%esp)
c01039c4:	c0 
c01039c5:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01039cc:	c0 
c01039cd:	c7 44 24 04 c6 00 00 	movl   $0xc6,0x4(%esp)
c01039d4:	00 
c01039d5:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01039dc:	e8 42 d2 ff ff       	call   c0100c23 <__panic>
    assert((p1 = alloc_page()) != NULL);
c01039e1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01039e8:	e8 88 12 00 00       	call   c0104c75 <alloc_pages>
c01039ed:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01039f0:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01039f4:	75 24                	jne    c0103a1a <basic_check+0x38e>
c01039f6:	c7 44 24 0c 60 a4 10 	movl   $0xc010a460,0xc(%esp)
c01039fd:	c0 
c01039fe:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103a05:	c0 
c0103a06:	c7 44 24 04 c7 00 00 	movl   $0xc7,0x4(%esp)
c0103a0d:	00 
c0103a0e:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103a15:	e8 09 d2 ff ff       	call   c0100c23 <__panic>
    assert((p2 = alloc_page()) != NULL);
c0103a1a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103a21:	e8 4f 12 00 00       	call   c0104c75 <alloc_pages>
c0103a26:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103a29:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103a2d:	75 24                	jne    c0103a53 <basic_check+0x3c7>
c0103a2f:	c7 44 24 0c 7c a4 10 	movl   $0xc010a47c,0xc(%esp)
c0103a36:	c0 
c0103a37:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103a3e:	c0 
c0103a3f:	c7 44 24 04 c8 00 00 	movl   $0xc8,0x4(%esp)
c0103a46:	00 
c0103a47:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103a4e:	e8 d0 d1 ff ff       	call   c0100c23 <__panic>

    assert(alloc_page() == NULL);
c0103a53:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103a5a:	e8 16 12 00 00       	call   c0104c75 <alloc_pages>
c0103a5f:	85 c0                	test   %eax,%eax
c0103a61:	74 24                	je     c0103a87 <basic_check+0x3fb>
c0103a63:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c0103a6a:	c0 
c0103a6b:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103a72:	c0 
c0103a73:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0103a7a:	00 
c0103a7b:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103a82:	e8 9c d1 ff ff       	call   c0100c23 <__panic>

    free_page(p0);
c0103a87:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103a8e:	00 
c0103a8f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103a92:	89 04 24             	mov    %eax,(%esp)
c0103a95:	e8 46 12 00 00       	call   c0104ce0 <free_pages>
c0103a9a:	c7 45 d8 18 7b 12 c0 	movl   $0xc0127b18,-0x28(%ebp)
c0103aa1:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103aa4:	8b 40 04             	mov    0x4(%eax),%eax
c0103aa7:	39 45 d8             	cmp    %eax,-0x28(%ebp)
c0103aaa:	0f 94 c0             	sete   %al
c0103aad:	0f b6 c0             	movzbl %al,%eax
    assert(!list_empty(&free_list));
c0103ab0:	85 c0                	test   %eax,%eax
c0103ab2:	74 24                	je     c0103ad8 <basic_check+0x44c>
c0103ab4:	c7 44 24 0c 88 a5 10 	movl   $0xc010a588,0xc(%esp)
c0103abb:	c0 
c0103abc:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103ac3:	c0 
c0103ac4:	c7 44 24 04 cd 00 00 	movl   $0xcd,0x4(%esp)
c0103acb:	00 
c0103acc:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103ad3:	e8 4b d1 ff ff       	call   c0100c23 <__panic>

    struct Page *p;
    assert((p = alloc_page()) == p0);
c0103ad8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103adf:	e8 91 11 00 00       	call   c0104c75 <alloc_pages>
c0103ae4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103ae7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103aea:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0103aed:	74 24                	je     c0103b13 <basic_check+0x487>
c0103aef:	c7 44 24 0c a0 a5 10 	movl   $0xc010a5a0,0xc(%esp)
c0103af6:	c0 
c0103af7:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103afe:	c0 
c0103aff:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c0103b06:	00 
c0103b07:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103b0e:	e8 10 d1 ff ff       	call   c0100c23 <__panic>
    assert(alloc_page() == NULL);
c0103b13:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103b1a:	e8 56 11 00 00       	call   c0104c75 <alloc_pages>
c0103b1f:	85 c0                	test   %eax,%eax
c0103b21:	74 24                	je     c0103b47 <basic_check+0x4bb>
c0103b23:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c0103b2a:	c0 
c0103b2b:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103b32:	c0 
c0103b33:	c7 44 24 04 d1 00 00 	movl   $0xd1,0x4(%esp)
c0103b3a:	00 
c0103b3b:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103b42:	e8 dc d0 ff ff       	call   c0100c23 <__panic>

    assert(nr_free == 0);
c0103b47:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0103b4c:	85 c0                	test   %eax,%eax
c0103b4e:	74 24                	je     c0103b74 <basic_check+0x4e8>
c0103b50:	c7 44 24 0c b9 a5 10 	movl   $0xc010a5b9,0xc(%esp)
c0103b57:	c0 
c0103b58:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103b5f:	c0 
c0103b60:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c0103b67:	00 
c0103b68:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103b6f:	e8 af d0 ff ff       	call   c0100c23 <__panic>
    free_list = free_list_store;
c0103b74:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0103b77:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0103b7a:	a3 18 7b 12 c0       	mov    %eax,0xc0127b18
c0103b7f:	89 15 1c 7b 12 c0    	mov    %edx,0xc0127b1c
    nr_free = nr_free_store;
c0103b85:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103b88:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20

    free_page(p);
c0103b8d:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103b94:	00 
c0103b95:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103b98:	89 04 24             	mov    %eax,(%esp)
c0103b9b:	e8 40 11 00 00       	call   c0104ce0 <free_pages>
    free_page(p1);
c0103ba0:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103ba7:	00 
c0103ba8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103bab:	89 04 24             	mov    %eax,(%esp)
c0103bae:	e8 2d 11 00 00       	call   c0104ce0 <free_pages>
    free_page(p2);
c0103bb3:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103bba:	00 
c0103bbb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103bbe:	89 04 24             	mov    %eax,(%esp)
c0103bc1:	e8 1a 11 00 00       	call   c0104ce0 <free_pages>
}
c0103bc6:	c9                   	leave  
c0103bc7:	c3                   	ret    

c0103bc8 <default_check>:

// LAB2: below code is used to check the first fit allocation algorithm (your EXERCISE 1) 
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
c0103bc8:	55                   	push   %ebp
c0103bc9:	89 e5                	mov    %esp,%ebp
c0103bcb:	53                   	push   %ebx
c0103bcc:	81 ec 94 00 00 00    	sub    $0x94,%esp
    int count = 0, total = 0;
c0103bd2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0103bd9:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    list_entry_t *le = &free_list;
c0103be0:	c7 45 ec 18 7b 12 c0 	movl   $0xc0127b18,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0103be7:	eb 6b                	jmp    c0103c54 <default_check+0x8c>
        struct Page *p = le2page(le, page_link);
c0103be9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103bec:	83 e8 0c             	sub    $0xc,%eax
c0103bef:	89 45 e8             	mov    %eax,-0x18(%ebp)
        assert(PageProperty(p));
c0103bf2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103bf5:	83 c0 04             	add    $0x4,%eax
c0103bf8:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0103bff:	89 45 cc             	mov    %eax,-0x34(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103c02:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0103c05:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0103c08:	0f a3 10             	bt     %edx,(%eax)
c0103c0b:	19 c0                	sbb    %eax,%eax
c0103c0d:	89 45 c8             	mov    %eax,-0x38(%ebp)
    return oldbit != 0;
c0103c10:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0103c14:	0f 95 c0             	setne  %al
c0103c17:	0f b6 c0             	movzbl %al,%eax
c0103c1a:	85 c0                	test   %eax,%eax
c0103c1c:	75 24                	jne    c0103c42 <default_check+0x7a>
c0103c1e:	c7 44 24 0c c6 a5 10 	movl   $0xc010a5c6,0xc(%esp)
c0103c25:	c0 
c0103c26:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103c2d:	c0 
c0103c2e:	c7 44 24 04 e4 00 00 	movl   $0xe4,0x4(%esp)
c0103c35:	00 
c0103c36:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103c3d:	e8 e1 cf ff ff       	call   c0100c23 <__panic>
        count ++, total += p->property;
c0103c42:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0103c46:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103c49:	8b 50 08             	mov    0x8(%eax),%edx
c0103c4c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103c4f:	01 d0                	add    %edx,%eax
c0103c51:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103c54:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103c57:	89 45 c4             	mov    %eax,-0x3c(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0103c5a:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0103c5d:	8b 40 04             	mov    0x4(%eax),%eax
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
    int count = 0, total = 0;
    list_entry_t *le = &free_list;
    while ((le = list_next(le)) != &free_list) {
c0103c60:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0103c63:	81 7d ec 18 7b 12 c0 	cmpl   $0xc0127b18,-0x14(%ebp)
c0103c6a:	0f 85 79 ff ff ff    	jne    c0103be9 <default_check+0x21>
        struct Page *p = le2page(le, page_link);
        assert(PageProperty(p));
        count ++, total += p->property;
    }
    assert(total == nr_free_pages());
c0103c70:	8b 5d f0             	mov    -0x10(%ebp),%ebx
c0103c73:	e8 9a 10 00 00       	call   c0104d12 <nr_free_pages>
c0103c78:	39 c3                	cmp    %eax,%ebx
c0103c7a:	74 24                	je     c0103ca0 <default_check+0xd8>
c0103c7c:	c7 44 24 0c d6 a5 10 	movl   $0xc010a5d6,0xc(%esp)
c0103c83:	c0 
c0103c84:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103c8b:	c0 
c0103c8c:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c0103c93:	00 
c0103c94:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103c9b:	e8 83 cf ff ff       	call   c0100c23 <__panic>

    basic_check();
c0103ca0:	e8 e7 f9 ff ff       	call   c010368c <basic_check>

    struct Page *p0 = alloc_pages(5), *p1, *p2;
c0103ca5:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c0103cac:	e8 c4 0f 00 00       	call   c0104c75 <alloc_pages>
c0103cb1:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(p0 != NULL);
c0103cb4:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0103cb8:	75 24                	jne    c0103cde <default_check+0x116>
c0103cba:	c7 44 24 0c ef a5 10 	movl   $0xc010a5ef,0xc(%esp)
c0103cc1:	c0 
c0103cc2:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103cc9:	c0 
c0103cca:	c7 44 24 04 ec 00 00 	movl   $0xec,0x4(%esp)
c0103cd1:	00 
c0103cd2:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103cd9:	e8 45 cf ff ff       	call   c0100c23 <__panic>
    assert(!PageProperty(p0));
c0103cde:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103ce1:	83 c0 04             	add    $0x4,%eax
c0103ce4:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c0103ceb:	89 45 bc             	mov    %eax,-0x44(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103cee:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0103cf1:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0103cf4:	0f a3 10             	bt     %edx,(%eax)
c0103cf7:	19 c0                	sbb    %eax,%eax
c0103cf9:	89 45 b8             	mov    %eax,-0x48(%ebp)
    return oldbit != 0;
c0103cfc:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c0103d00:	0f 95 c0             	setne  %al
c0103d03:	0f b6 c0             	movzbl %al,%eax
c0103d06:	85 c0                	test   %eax,%eax
c0103d08:	74 24                	je     c0103d2e <default_check+0x166>
c0103d0a:	c7 44 24 0c fa a5 10 	movl   $0xc010a5fa,0xc(%esp)
c0103d11:	c0 
c0103d12:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103d19:	c0 
c0103d1a:	c7 44 24 04 ed 00 00 	movl   $0xed,0x4(%esp)
c0103d21:	00 
c0103d22:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103d29:	e8 f5 ce ff ff       	call   c0100c23 <__panic>

    list_entry_t free_list_store = free_list;
c0103d2e:	a1 18 7b 12 c0       	mov    0xc0127b18,%eax
c0103d33:	8b 15 1c 7b 12 c0    	mov    0xc0127b1c,%edx
c0103d39:	89 45 80             	mov    %eax,-0x80(%ebp)
c0103d3c:	89 55 84             	mov    %edx,-0x7c(%ebp)
c0103d3f:	c7 45 b4 18 7b 12 c0 	movl   $0xc0127b18,-0x4c(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0103d46:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103d49:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0103d4c:	89 50 04             	mov    %edx,0x4(%eax)
c0103d4f:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103d52:	8b 50 04             	mov    0x4(%eax),%edx
c0103d55:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0103d58:	89 10                	mov    %edx,(%eax)
c0103d5a:	c7 45 b0 18 7b 12 c0 	movl   $0xc0127b18,-0x50(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0103d61:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0103d64:	8b 40 04             	mov    0x4(%eax),%eax
c0103d67:	39 45 b0             	cmp    %eax,-0x50(%ebp)
c0103d6a:	0f 94 c0             	sete   %al
c0103d6d:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0103d70:	85 c0                	test   %eax,%eax
c0103d72:	75 24                	jne    c0103d98 <default_check+0x1d0>
c0103d74:	c7 44 24 0c 4f a5 10 	movl   $0xc010a54f,0xc(%esp)
c0103d7b:	c0 
c0103d7c:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103d83:	c0 
c0103d84:	c7 44 24 04 f1 00 00 	movl   $0xf1,0x4(%esp)
c0103d8b:	00 
c0103d8c:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103d93:	e8 8b ce ff ff       	call   c0100c23 <__panic>
    assert(alloc_page() == NULL);
c0103d98:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103d9f:	e8 d1 0e 00 00       	call   c0104c75 <alloc_pages>
c0103da4:	85 c0                	test   %eax,%eax
c0103da6:	74 24                	je     c0103dcc <default_check+0x204>
c0103da8:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c0103daf:	c0 
c0103db0:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103db7:	c0 
c0103db8:	c7 44 24 04 f2 00 00 	movl   $0xf2,0x4(%esp)
c0103dbf:	00 
c0103dc0:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103dc7:	e8 57 ce ff ff       	call   c0100c23 <__panic>

    unsigned int nr_free_store = nr_free;
c0103dcc:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0103dd1:	89 45 e0             	mov    %eax,-0x20(%ebp)
    nr_free = 0;
c0103dd4:	c7 05 20 7b 12 c0 00 	movl   $0x0,0xc0127b20
c0103ddb:	00 00 00 

    free_pages(p0 + 2, 3);
c0103dde:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103de1:	83 c0 40             	add    $0x40,%eax
c0103de4:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0103deb:	00 
c0103dec:	89 04 24             	mov    %eax,(%esp)
c0103def:	e8 ec 0e 00 00       	call   c0104ce0 <free_pages>
    assert(alloc_pages(4) == NULL);
c0103df4:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0103dfb:	e8 75 0e 00 00       	call   c0104c75 <alloc_pages>
c0103e00:	85 c0                	test   %eax,%eax
c0103e02:	74 24                	je     c0103e28 <default_check+0x260>
c0103e04:	c7 44 24 0c 0c a6 10 	movl   $0xc010a60c,0xc(%esp)
c0103e0b:	c0 
c0103e0c:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103e13:	c0 
c0103e14:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0103e1b:	00 
c0103e1c:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103e23:	e8 fb cd ff ff       	call   c0100c23 <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 3);
c0103e28:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103e2b:	83 c0 40             	add    $0x40,%eax
c0103e2e:	83 c0 04             	add    $0x4,%eax
c0103e31:	c7 45 ac 01 00 00 00 	movl   $0x1,-0x54(%ebp)
c0103e38:	89 45 a8             	mov    %eax,-0x58(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103e3b:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0103e3e:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0103e41:	0f a3 10             	bt     %edx,(%eax)
c0103e44:	19 c0                	sbb    %eax,%eax
c0103e46:	89 45 a4             	mov    %eax,-0x5c(%ebp)
    return oldbit != 0;
c0103e49:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c0103e4d:	0f 95 c0             	setne  %al
c0103e50:	0f b6 c0             	movzbl %al,%eax
c0103e53:	85 c0                	test   %eax,%eax
c0103e55:	74 0e                	je     c0103e65 <default_check+0x29d>
c0103e57:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103e5a:	83 c0 40             	add    $0x40,%eax
c0103e5d:	8b 40 08             	mov    0x8(%eax),%eax
c0103e60:	83 f8 03             	cmp    $0x3,%eax
c0103e63:	74 24                	je     c0103e89 <default_check+0x2c1>
c0103e65:	c7 44 24 0c 24 a6 10 	movl   $0xc010a624,0xc(%esp)
c0103e6c:	c0 
c0103e6d:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103e74:	c0 
c0103e75:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0103e7c:	00 
c0103e7d:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103e84:	e8 9a cd ff ff       	call   c0100c23 <__panic>
    assert((p1 = alloc_pages(3)) != NULL);
c0103e89:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
c0103e90:	e8 e0 0d 00 00       	call   c0104c75 <alloc_pages>
c0103e95:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0103e98:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0103e9c:	75 24                	jne    c0103ec2 <default_check+0x2fa>
c0103e9e:	c7 44 24 0c 50 a6 10 	movl   $0xc010a650,0xc(%esp)
c0103ea5:	c0 
c0103ea6:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103ead:	c0 
c0103eae:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0103eb5:	00 
c0103eb6:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103ebd:	e8 61 cd ff ff       	call   c0100c23 <__panic>
    assert(alloc_page() == NULL);
c0103ec2:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0103ec9:	e8 a7 0d 00 00       	call   c0104c75 <alloc_pages>
c0103ece:	85 c0                	test   %eax,%eax
c0103ed0:	74 24                	je     c0103ef6 <default_check+0x32e>
c0103ed2:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c0103ed9:	c0 
c0103eda:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103ee1:	c0 
c0103ee2:	c7 44 24 04 fb 00 00 	movl   $0xfb,0x4(%esp)
c0103ee9:	00 
c0103eea:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103ef1:	e8 2d cd ff ff       	call   c0100c23 <__panic>
    assert(p0 + 2 == p1);
c0103ef6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103ef9:	83 c0 40             	add    $0x40,%eax
c0103efc:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c0103eff:	74 24                	je     c0103f25 <default_check+0x35d>
c0103f01:	c7 44 24 0c 6e a6 10 	movl   $0xc010a66e,0xc(%esp)
c0103f08:	c0 
c0103f09:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103f10:	c0 
c0103f11:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0103f18:	00 
c0103f19:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103f20:	e8 fe cc ff ff       	call   c0100c23 <__panic>

    p2 = p0 + 1;
c0103f25:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f28:	83 c0 20             	add    $0x20,%eax
c0103f2b:	89 45 d8             	mov    %eax,-0x28(%ebp)
    free_page(p0);
c0103f2e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103f35:	00 
c0103f36:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f39:	89 04 24             	mov    %eax,(%esp)
c0103f3c:	e8 9f 0d 00 00       	call   c0104ce0 <free_pages>
    free_pages(p1, 3);
c0103f41:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c0103f48:	00 
c0103f49:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103f4c:	89 04 24             	mov    %eax,(%esp)
c0103f4f:	e8 8c 0d 00 00       	call   c0104ce0 <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c0103f54:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f57:	83 c0 04             	add    $0x4,%eax
c0103f5a:	c7 45 a0 01 00 00 00 	movl   $0x1,-0x60(%ebp)
c0103f61:	89 45 9c             	mov    %eax,-0x64(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103f64:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0103f67:	8b 55 a0             	mov    -0x60(%ebp),%edx
c0103f6a:	0f a3 10             	bt     %edx,(%eax)
c0103f6d:	19 c0                	sbb    %eax,%eax
c0103f6f:	89 45 98             	mov    %eax,-0x68(%ebp)
    return oldbit != 0;
c0103f72:	83 7d 98 00          	cmpl   $0x0,-0x68(%ebp)
c0103f76:	0f 95 c0             	setne  %al
c0103f79:	0f b6 c0             	movzbl %al,%eax
c0103f7c:	85 c0                	test   %eax,%eax
c0103f7e:	74 0b                	je     c0103f8b <default_check+0x3c3>
c0103f80:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f83:	8b 40 08             	mov    0x8(%eax),%eax
c0103f86:	83 f8 01             	cmp    $0x1,%eax
c0103f89:	74 24                	je     c0103faf <default_check+0x3e7>
c0103f8b:	c7 44 24 0c 7c a6 10 	movl   $0xc010a67c,0xc(%esp)
c0103f92:	c0 
c0103f93:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103f9a:	c0 
c0103f9b:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c0103fa2:	00 
c0103fa3:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0103faa:	e8 74 cc ff ff       	call   c0100c23 <__panic>
    assert(PageProperty(p1) && p1->property == 3);
c0103faf:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103fb2:	83 c0 04             	add    $0x4,%eax
c0103fb5:	c7 45 94 01 00 00 00 	movl   $0x1,-0x6c(%ebp)
c0103fbc:	89 45 90             	mov    %eax,-0x70(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0103fbf:	8b 45 90             	mov    -0x70(%ebp),%eax
c0103fc2:	8b 55 94             	mov    -0x6c(%ebp),%edx
c0103fc5:	0f a3 10             	bt     %edx,(%eax)
c0103fc8:	19 c0                	sbb    %eax,%eax
c0103fca:	89 45 8c             	mov    %eax,-0x74(%ebp)
    return oldbit != 0;
c0103fcd:	83 7d 8c 00          	cmpl   $0x0,-0x74(%ebp)
c0103fd1:	0f 95 c0             	setne  %al
c0103fd4:	0f b6 c0             	movzbl %al,%eax
c0103fd7:	85 c0                	test   %eax,%eax
c0103fd9:	74 0b                	je     c0103fe6 <default_check+0x41e>
c0103fdb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103fde:	8b 40 08             	mov    0x8(%eax),%eax
c0103fe1:	83 f8 03             	cmp    $0x3,%eax
c0103fe4:	74 24                	je     c010400a <default_check+0x442>
c0103fe6:	c7 44 24 0c a4 a6 10 	movl   $0xc010a6a4,0xc(%esp)
c0103fed:	c0 
c0103fee:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0103ff5:	c0 
c0103ff6:	c7 44 24 04 02 01 00 	movl   $0x102,0x4(%esp)
c0103ffd:	00 
c0103ffe:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104005:	e8 19 cc ff ff       	call   c0100c23 <__panic>

    assert((p0 = alloc_page()) == p2 - 1);
c010400a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0104011:	e8 5f 0c 00 00       	call   c0104c75 <alloc_pages>
c0104016:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0104019:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010401c:	83 e8 20             	sub    $0x20,%eax
c010401f:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c0104022:	74 24                	je     c0104048 <default_check+0x480>
c0104024:	c7 44 24 0c ca a6 10 	movl   $0xc010a6ca,0xc(%esp)
c010402b:	c0 
c010402c:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0104033:	c0 
c0104034:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c010403b:	00 
c010403c:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104043:	e8 db cb ff ff       	call   c0100c23 <__panic>
    free_page(p0);
c0104048:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010404f:	00 
c0104050:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104053:	89 04 24             	mov    %eax,(%esp)
c0104056:	e8 85 0c 00 00       	call   c0104ce0 <free_pages>
    assert((p0 = alloc_pages(2)) == p2 + 1);
c010405b:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0104062:	e8 0e 0c 00 00       	call   c0104c75 <alloc_pages>
c0104067:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010406a:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010406d:	83 c0 20             	add    $0x20,%eax
c0104070:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c0104073:	74 24                	je     c0104099 <default_check+0x4d1>
c0104075:	c7 44 24 0c e8 a6 10 	movl   $0xc010a6e8,0xc(%esp)
c010407c:	c0 
c010407d:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0104084:	c0 
c0104085:	c7 44 24 04 06 01 00 	movl   $0x106,0x4(%esp)
c010408c:	00 
c010408d:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104094:	e8 8a cb ff ff       	call   c0100c23 <__panic>

    free_pages(p0, 2);
c0104099:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c01040a0:	00 
c01040a1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01040a4:	89 04 24             	mov    %eax,(%esp)
c01040a7:	e8 34 0c 00 00       	call   c0104ce0 <free_pages>
    free_page(p2);
c01040ac:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01040b3:	00 
c01040b4:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01040b7:	89 04 24             	mov    %eax,(%esp)
c01040ba:	e8 21 0c 00 00       	call   c0104ce0 <free_pages>

    assert((p0 = alloc_pages(5)) != NULL);
c01040bf:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c01040c6:	e8 aa 0b 00 00       	call   c0104c75 <alloc_pages>
c01040cb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01040ce:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01040d2:	75 24                	jne    c01040f8 <default_check+0x530>
c01040d4:	c7 44 24 0c 08 a7 10 	movl   $0xc010a708,0xc(%esp)
c01040db:	c0 
c01040dc:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01040e3:	c0 
c01040e4:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c01040eb:	00 
c01040ec:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01040f3:	e8 2b cb ff ff       	call   c0100c23 <__panic>
    assert(alloc_page() == NULL);
c01040f8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01040ff:	e8 71 0b 00 00       	call   c0104c75 <alloc_pages>
c0104104:	85 c0                	test   %eax,%eax
c0104106:	74 24                	je     c010412c <default_check+0x564>
c0104108:	c7 44 24 0c 66 a5 10 	movl   $0xc010a566,0xc(%esp)
c010410f:	c0 
c0104110:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0104117:	c0 
c0104118:	c7 44 24 04 0c 01 00 	movl   $0x10c,0x4(%esp)
c010411f:	00 
c0104120:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104127:	e8 f7 ca ff ff       	call   c0100c23 <__panic>

    assert(nr_free == 0);
c010412c:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0104131:	85 c0                	test   %eax,%eax
c0104133:	74 24                	je     c0104159 <default_check+0x591>
c0104135:	c7 44 24 0c b9 a5 10 	movl   $0xc010a5b9,0xc(%esp)
c010413c:	c0 
c010413d:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0104144:	c0 
c0104145:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c010414c:	00 
c010414d:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104154:	e8 ca ca ff ff       	call   c0100c23 <__panic>
    nr_free = nr_free_store;
c0104159:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010415c:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20

    free_list = free_list_store;
c0104161:	8b 45 80             	mov    -0x80(%ebp),%eax
c0104164:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0104167:	a3 18 7b 12 c0       	mov    %eax,0xc0127b18
c010416c:	89 15 1c 7b 12 c0    	mov    %edx,0xc0127b1c
    free_pages(p0, 5);
c0104172:	c7 44 24 04 05 00 00 	movl   $0x5,0x4(%esp)
c0104179:	00 
c010417a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010417d:	89 04 24             	mov    %eax,(%esp)
c0104180:	e8 5b 0b 00 00       	call   c0104ce0 <free_pages>

    le = &free_list;
c0104185:	c7 45 ec 18 7b 12 c0 	movl   $0xc0127b18,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c010418c:	eb 1d                	jmp    c01041ab <default_check+0x5e3>
        struct Page *p = le2page(le, page_link);
c010418e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104191:	83 e8 0c             	sub    $0xc,%eax
c0104194:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        count --, total -= p->property;
c0104197:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c010419b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010419e:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01041a1:	8b 40 08             	mov    0x8(%eax),%eax
c01041a4:	29 c2                	sub    %eax,%edx
c01041a6:	89 d0                	mov    %edx,%eax
c01041a8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01041ab:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01041ae:	89 45 88             	mov    %eax,-0x78(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01041b1:	8b 45 88             	mov    -0x78(%ebp),%eax
c01041b4:	8b 40 04             	mov    0x4(%eax),%eax

    free_list = free_list_store;
    free_pages(p0, 5);

    le = &free_list;
    while ((le = list_next(le)) != &free_list) {
c01041b7:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01041ba:	81 7d ec 18 7b 12 c0 	cmpl   $0xc0127b18,-0x14(%ebp)
c01041c1:	75 cb                	jne    c010418e <default_check+0x5c6>
        struct Page *p = le2page(le, page_link);
        count --, total -= p->property;
    }
    assert(count == 0);
c01041c3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01041c7:	74 24                	je     c01041ed <default_check+0x625>
c01041c9:	c7 44 24 0c 26 a7 10 	movl   $0xc010a726,0xc(%esp)
c01041d0:	c0 
c01041d1:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c01041d8:	c0 
c01041d9:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c01041e0:	00 
c01041e1:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c01041e8:	e8 36 ca ff ff       	call   c0100c23 <__panic>
    assert(total == 0);
c01041ed:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01041f1:	74 24                	je     c0104217 <default_check+0x64f>
c01041f3:	c7 44 24 0c 31 a7 10 	movl   $0xc010a731,0xc(%esp)
c01041fa:	c0 
c01041fb:	c7 44 24 08 f6 a3 10 	movl   $0xc010a3f6,0x8(%esp)
c0104202:	c0 
c0104203:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c010420a:	00 
c010420b:	c7 04 24 0b a4 10 c0 	movl   $0xc010a40b,(%esp)
c0104212:	e8 0c ca ff ff       	call   c0100c23 <__panic>
}
c0104217:	81 c4 94 00 00 00    	add    $0x94,%esp
c010421d:	5b                   	pop    %ebx
c010421e:	5d                   	pop    %ebp
c010421f:	c3                   	ret    

c0104220 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0104220:	55                   	push   %ebp
c0104221:	89 e5                	mov    %esp,%ebp
c0104223:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0104226:	9c                   	pushf  
c0104227:	58                   	pop    %eax
c0104228:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c010422b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010422e:	25 00 02 00 00       	and    $0x200,%eax
c0104233:	85 c0                	test   %eax,%eax
c0104235:	74 0c                	je     c0104243 <__intr_save+0x23>
        intr_disable();
c0104237:	e8 3f dc ff ff       	call   c0101e7b <intr_disable>
        return 1;
c010423c:	b8 01 00 00 00       	mov    $0x1,%eax
c0104241:	eb 05                	jmp    c0104248 <__intr_save+0x28>
    }
    return 0;
c0104243:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104248:	c9                   	leave  
c0104249:	c3                   	ret    

c010424a <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c010424a:	55                   	push   %ebp
c010424b:	89 e5                	mov    %esp,%ebp
c010424d:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0104250:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104254:	74 05                	je     c010425b <__intr_restore+0x11>
        intr_enable();
c0104256:	e8 1a dc ff ff       	call   c0101e75 <intr_enable>
    }
}
c010425b:	c9                   	leave  
c010425c:	c3                   	ret    

c010425d <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c010425d:	55                   	push   %ebp
c010425e:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0104260:	8b 55 08             	mov    0x8(%ebp),%edx
c0104263:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c0104268:	29 c2                	sub    %eax,%edx
c010426a:	89 d0                	mov    %edx,%eax
c010426c:	c1 f8 05             	sar    $0x5,%eax
}
c010426f:	5d                   	pop    %ebp
c0104270:	c3                   	ret    

c0104271 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c0104271:	55                   	push   %ebp
c0104272:	89 e5                	mov    %esp,%ebp
c0104274:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0104277:	8b 45 08             	mov    0x8(%ebp),%eax
c010427a:	89 04 24             	mov    %eax,(%esp)
c010427d:	e8 db ff ff ff       	call   c010425d <page2ppn>
c0104282:	c1 e0 0c             	shl    $0xc,%eax
}
c0104285:	c9                   	leave  
c0104286:	c3                   	ret    

c0104287 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0104287:	55                   	push   %ebp
c0104288:	89 e5                	mov    %esp,%ebp
c010428a:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c010428d:	8b 45 08             	mov    0x8(%ebp),%eax
c0104290:	c1 e8 0c             	shr    $0xc,%eax
c0104293:	89 c2                	mov    %eax,%edx
c0104295:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c010429a:	39 c2                	cmp    %eax,%edx
c010429c:	72 1c                	jb     c01042ba <pa2page+0x33>
        panic("pa2page called with invalid pa");
c010429e:	c7 44 24 08 6c a7 10 	movl   $0xc010a76c,0x8(%esp)
c01042a5:	c0 
c01042a6:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01042ad:	00 
c01042ae:	c7 04 24 8b a7 10 c0 	movl   $0xc010a78b,(%esp)
c01042b5:	e8 69 c9 ff ff       	call   c0100c23 <__panic>
    }
    return &pages[PPN(pa)];
c01042ba:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c01042bf:	8b 55 08             	mov    0x8(%ebp),%edx
c01042c2:	c1 ea 0c             	shr    $0xc,%edx
c01042c5:	c1 e2 05             	shl    $0x5,%edx
c01042c8:	01 d0                	add    %edx,%eax
}
c01042ca:	c9                   	leave  
c01042cb:	c3                   	ret    

c01042cc <page2kva>:

static inline void *
page2kva(struct Page *page) {
c01042cc:	55                   	push   %ebp
c01042cd:	89 e5                	mov    %esp,%ebp
c01042cf:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01042d2:	8b 45 08             	mov    0x8(%ebp),%eax
c01042d5:	89 04 24             	mov    %eax,(%esp)
c01042d8:	e8 94 ff ff ff       	call   c0104271 <page2pa>
c01042dd:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01042e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01042e3:	c1 e8 0c             	shr    $0xc,%eax
c01042e6:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01042e9:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01042ee:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01042f1:	72 23                	jb     c0104316 <page2kva+0x4a>
c01042f3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01042f6:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01042fa:	c7 44 24 08 9c a7 10 	movl   $0xc010a79c,0x8(%esp)
c0104301:	c0 
c0104302:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0104309:	00 
c010430a:	c7 04 24 8b a7 10 c0 	movl   $0xc010a78b,(%esp)
c0104311:	e8 0d c9 ff ff       	call   c0100c23 <__panic>
c0104316:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104319:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010431e:	c9                   	leave  
c010431f:	c3                   	ret    

c0104320 <kva2page>:

static inline struct Page *
kva2page(void *kva) {
c0104320:	55                   	push   %ebp
c0104321:	89 e5                	mov    %esp,%ebp
c0104323:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0104326:	8b 45 08             	mov    0x8(%ebp),%eax
c0104329:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010432c:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0104333:	77 23                	ja     c0104358 <kva2page+0x38>
c0104335:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104338:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010433c:	c7 44 24 08 c0 a7 10 	movl   $0xc010a7c0,0x8(%esp)
c0104343:	c0 
c0104344:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c010434b:	00 
c010434c:	c7 04 24 8b a7 10 c0 	movl   $0xc010a78b,(%esp)
c0104353:	e8 cb c8 ff ff       	call   c0100c23 <__panic>
c0104358:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010435b:	05 00 00 00 40       	add    $0x40000000,%eax
c0104360:	89 04 24             	mov    %eax,(%esp)
c0104363:	e8 1f ff ff ff       	call   c0104287 <pa2page>
}
c0104368:	c9                   	leave  
c0104369:	c3                   	ret    

c010436a <__slob_get_free_pages>:
static slob_t *slobfree = &arena;
static bigblock_t *bigblocks;


static void* __slob_get_free_pages(gfp_t gfp, int order)
{
c010436a:	55                   	push   %ebp
c010436b:	89 e5                	mov    %esp,%ebp
c010436d:	83 ec 28             	sub    $0x28,%esp
  struct Page * page = alloc_pages(1 << order);
c0104370:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104373:	ba 01 00 00 00       	mov    $0x1,%edx
c0104378:	89 c1                	mov    %eax,%ecx
c010437a:	d3 e2                	shl    %cl,%edx
c010437c:	89 d0                	mov    %edx,%eax
c010437e:	89 04 24             	mov    %eax,(%esp)
c0104381:	e8 ef 08 00 00       	call   c0104c75 <alloc_pages>
c0104386:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!page)
c0104389:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010438d:	75 07                	jne    c0104396 <__slob_get_free_pages+0x2c>
    return NULL;
c010438f:	b8 00 00 00 00       	mov    $0x0,%eax
c0104394:	eb 0b                	jmp    c01043a1 <__slob_get_free_pages+0x37>
  return page2kva(page);
c0104396:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104399:	89 04 24             	mov    %eax,(%esp)
c010439c:	e8 2b ff ff ff       	call   c01042cc <page2kva>
}
c01043a1:	c9                   	leave  
c01043a2:	c3                   	ret    

c01043a3 <__slob_free_pages>:

#define __slob_get_free_page(gfp) __slob_get_free_pages(gfp, 0)

static inline void __slob_free_pages(unsigned long kva, int order)
{
c01043a3:	55                   	push   %ebp
c01043a4:	89 e5                	mov    %esp,%ebp
c01043a6:	53                   	push   %ebx
c01043a7:	83 ec 14             	sub    $0x14,%esp
  free_pages(kva2page(kva), 1 << order);
c01043aa:	8b 45 0c             	mov    0xc(%ebp),%eax
c01043ad:	ba 01 00 00 00       	mov    $0x1,%edx
c01043b2:	89 c1                	mov    %eax,%ecx
c01043b4:	d3 e2                	shl    %cl,%edx
c01043b6:	89 d0                	mov    %edx,%eax
c01043b8:	89 c3                	mov    %eax,%ebx
c01043ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01043bd:	89 04 24             	mov    %eax,(%esp)
c01043c0:	e8 5b ff ff ff       	call   c0104320 <kva2page>
c01043c5:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c01043c9:	89 04 24             	mov    %eax,(%esp)
c01043cc:	e8 0f 09 00 00       	call   c0104ce0 <free_pages>
}
c01043d1:	83 c4 14             	add    $0x14,%esp
c01043d4:	5b                   	pop    %ebx
c01043d5:	5d                   	pop    %ebp
c01043d6:	c3                   	ret    

c01043d7 <slob_alloc>:

static void slob_free(void *b, int size);

static void *slob_alloc(size_t size, gfp_t gfp, int align)
{
c01043d7:	55                   	push   %ebp
c01043d8:	89 e5                	mov    %esp,%ebp
c01043da:	83 ec 38             	sub    $0x38,%esp
  assert( (size + SLOB_UNIT) < PAGE_SIZE );
c01043dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01043e0:	83 c0 08             	add    $0x8,%eax
c01043e3:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c01043e8:	76 24                	jbe    c010440e <slob_alloc+0x37>
c01043ea:	c7 44 24 0c e4 a7 10 	movl   $0xc010a7e4,0xc(%esp)
c01043f1:	c0 
c01043f2:	c7 44 24 08 03 a8 10 	movl   $0xc010a803,0x8(%esp)
c01043f9:	c0 
c01043fa:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0104401:	00 
c0104402:	c7 04 24 18 a8 10 c0 	movl   $0xc010a818,(%esp)
c0104409:	e8 15 c8 ff ff       	call   c0100c23 <__panic>

	slob_t *prev, *cur, *aligned = 0;
c010440e:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
	int delta = 0, units = SLOB_UNITS(size);
c0104415:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c010441c:	8b 45 08             	mov    0x8(%ebp),%eax
c010441f:	83 c0 07             	add    $0x7,%eax
c0104422:	c1 e8 03             	shr    $0x3,%eax
c0104425:	89 45 e0             	mov    %eax,-0x20(%ebp)
	unsigned long flags;

	spin_lock_irqsave(&slob_lock, flags);
c0104428:	e8 f3 fd ff ff       	call   c0104220 <__intr_save>
c010442d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	prev = slobfree;
c0104430:	a1 08 4a 12 c0       	mov    0xc0124a08,%eax
c0104435:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0104438:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010443b:	8b 40 04             	mov    0x4(%eax),%eax
c010443e:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0104441:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104445:	74 25                	je     c010446c <slob_alloc+0x95>
			aligned = (slob_t *)ALIGN((unsigned long)cur, align);
c0104447:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010444a:	8b 45 10             	mov    0x10(%ebp),%eax
c010444d:	01 d0                	add    %edx,%eax
c010444f:	8d 50 ff             	lea    -0x1(%eax),%edx
c0104452:	8b 45 10             	mov    0x10(%ebp),%eax
c0104455:	f7 d8                	neg    %eax
c0104457:	21 d0                	and    %edx,%eax
c0104459:	89 45 ec             	mov    %eax,-0x14(%ebp)
			delta = aligned - cur;
c010445c:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010445f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104462:	29 c2                	sub    %eax,%edx
c0104464:	89 d0                	mov    %edx,%eax
c0104466:	c1 f8 03             	sar    $0x3,%eax
c0104469:	89 45 e8             	mov    %eax,-0x18(%ebp)
		}
		if (cur->units >= units + delta) { /* room enough? */
c010446c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010446f:	8b 00                	mov    (%eax),%eax
c0104471:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104474:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0104477:	01 ca                	add    %ecx,%edx
c0104479:	39 d0                	cmp    %edx,%eax
c010447b:	0f 8c aa 00 00 00    	jl     c010452b <slob_alloc+0x154>
			if (delta) { /* need to fragment head to align? */
c0104481:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0104485:	74 38                	je     c01044bf <slob_alloc+0xe8>
				aligned->units = cur->units - delta;
c0104487:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010448a:	8b 00                	mov    (%eax),%eax
c010448c:	2b 45 e8             	sub    -0x18(%ebp),%eax
c010448f:	89 c2                	mov    %eax,%edx
c0104491:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104494:	89 10                	mov    %edx,(%eax)
				aligned->next = cur->next;
c0104496:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104499:	8b 50 04             	mov    0x4(%eax),%edx
c010449c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010449f:	89 50 04             	mov    %edx,0x4(%eax)
				cur->next = aligned;
c01044a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044a5:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01044a8:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = delta;
c01044ab:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044ae:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01044b1:	89 10                	mov    %edx,(%eax)
				prev = cur;
c01044b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044b6:	89 45 f4             	mov    %eax,-0xc(%ebp)
				cur = aligned;
c01044b9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01044bc:	89 45 f0             	mov    %eax,-0x10(%ebp)
			}

			if (cur->units == units) /* exact fit? */
c01044bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044c2:	8b 00                	mov    (%eax),%eax
c01044c4:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c01044c7:	75 0e                	jne    c01044d7 <slob_alloc+0x100>
				prev->next = cur->next; /* unlink */
c01044c9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044cc:	8b 50 04             	mov    0x4(%eax),%edx
c01044cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01044d2:	89 50 04             	mov    %edx,0x4(%eax)
c01044d5:	eb 3c                	jmp    c0104513 <slob_alloc+0x13c>
			else { /* fragment */
				prev->next = cur + units;
c01044d7:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01044da:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c01044e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01044e4:	01 c2                	add    %eax,%edx
c01044e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01044e9:	89 50 04             	mov    %edx,0x4(%eax)
				prev->next->units = cur->units - units;
c01044ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01044ef:	8b 40 04             	mov    0x4(%eax),%eax
c01044f2:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01044f5:	8b 12                	mov    (%edx),%edx
c01044f7:	2b 55 e0             	sub    -0x20(%ebp),%edx
c01044fa:	89 10                	mov    %edx,(%eax)
				prev->next->next = cur->next;
c01044fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01044ff:	8b 40 04             	mov    0x4(%eax),%eax
c0104502:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104505:	8b 52 04             	mov    0x4(%edx),%edx
c0104508:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = units;
c010450b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010450e:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104511:	89 10                	mov    %edx,(%eax)
			}

			slobfree = prev;
c0104513:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104516:	a3 08 4a 12 c0       	mov    %eax,0xc0124a08
			spin_unlock_irqrestore(&slob_lock, flags);
c010451b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010451e:	89 04 24             	mov    %eax,(%esp)
c0104521:	e8 24 fd ff ff       	call   c010424a <__intr_restore>
			return cur;
c0104526:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104529:	eb 7f                	jmp    c01045aa <slob_alloc+0x1d3>
		}
		if (cur == slobfree) {
c010452b:	a1 08 4a 12 c0       	mov    0xc0124a08,%eax
c0104530:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104533:	75 61                	jne    c0104596 <slob_alloc+0x1bf>
			spin_unlock_irqrestore(&slob_lock, flags);
c0104535:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104538:	89 04 24             	mov    %eax,(%esp)
c010453b:	e8 0a fd ff ff       	call   c010424a <__intr_restore>

			if (size == PAGE_SIZE) /* trying to shrink arena? */
c0104540:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c0104547:	75 07                	jne    c0104550 <slob_alloc+0x179>
				return 0;
c0104549:	b8 00 00 00 00       	mov    $0x0,%eax
c010454e:	eb 5a                	jmp    c01045aa <slob_alloc+0x1d3>

			cur = (slob_t *)__slob_get_free_page(gfp);
c0104550:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104557:	00 
c0104558:	8b 45 0c             	mov    0xc(%ebp),%eax
c010455b:	89 04 24             	mov    %eax,(%esp)
c010455e:	e8 07 fe ff ff       	call   c010436a <__slob_get_free_pages>
c0104563:	89 45 f0             	mov    %eax,-0x10(%ebp)
			if (!cur)
c0104566:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010456a:	75 07                	jne    c0104573 <slob_alloc+0x19c>
				return 0;
c010456c:	b8 00 00 00 00       	mov    $0x0,%eax
c0104571:	eb 37                	jmp    c01045aa <slob_alloc+0x1d3>

			slob_free(cur, PAGE_SIZE);
c0104573:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c010457a:	00 
c010457b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010457e:	89 04 24             	mov    %eax,(%esp)
c0104581:	e8 26 00 00 00       	call   c01045ac <slob_free>
			spin_lock_irqsave(&slob_lock, flags);
c0104586:	e8 95 fc ff ff       	call   c0104220 <__intr_save>
c010458b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
			cur = slobfree;
c010458e:	a1 08 4a 12 c0       	mov    0xc0124a08,%eax
c0104593:	89 45 f0             	mov    %eax,-0x10(%ebp)
	int delta = 0, units = SLOB_UNITS(size);
	unsigned long flags;

	spin_lock_irqsave(&slob_lock, flags);
	prev = slobfree;
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0104596:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104599:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010459c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010459f:	8b 40 04             	mov    0x4(%eax),%eax
c01045a2:	89 45 f0             	mov    %eax,-0x10(%ebp)

			slob_free(cur, PAGE_SIZE);
			spin_lock_irqsave(&slob_lock, flags);
			cur = slobfree;
		}
	}
c01045a5:	e9 97 fe ff ff       	jmp    c0104441 <slob_alloc+0x6a>
}
c01045aa:	c9                   	leave  
c01045ab:	c3                   	ret    

c01045ac <slob_free>:

static void slob_free(void *block, int size)
{
c01045ac:	55                   	push   %ebp
c01045ad:	89 e5                	mov    %esp,%ebp
c01045af:	83 ec 28             	sub    $0x28,%esp
	slob_t *cur, *b = (slob_t *)block;
c01045b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01045b5:	89 45 f0             	mov    %eax,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c01045b8:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01045bc:	75 05                	jne    c01045c3 <slob_free+0x17>
		return;
c01045be:	e9 ff 00 00 00       	jmp    c01046c2 <slob_free+0x116>

	if (size)
c01045c3:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01045c7:	74 10                	je     c01045d9 <slob_free+0x2d>
		b->units = SLOB_UNITS(size);
c01045c9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01045cc:	83 c0 07             	add    $0x7,%eax
c01045cf:	c1 e8 03             	shr    $0x3,%eax
c01045d2:	89 c2                	mov    %eax,%edx
c01045d4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01045d7:	89 10                	mov    %edx,(%eax)

	/* Find reinsertion point */
	spin_lock_irqsave(&slob_lock, flags);
c01045d9:	e8 42 fc ff ff       	call   c0104220 <__intr_save>
c01045de:	89 45 ec             	mov    %eax,-0x14(%ebp)
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c01045e1:	a1 08 4a 12 c0       	mov    0xc0124a08,%eax
c01045e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01045e9:	eb 27                	jmp    c0104612 <slob_free+0x66>
		if (cur >= cur->next && (b > cur || b < cur->next))
c01045eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01045ee:	8b 40 04             	mov    0x4(%eax),%eax
c01045f1:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01045f4:	77 13                	ja     c0104609 <slob_free+0x5d>
c01045f6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01045f9:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c01045fc:	77 27                	ja     c0104625 <slob_free+0x79>
c01045fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104601:	8b 40 04             	mov    0x4(%eax),%eax
c0104604:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0104607:	77 1c                	ja     c0104625 <slob_free+0x79>
	if (size)
		b->units = SLOB_UNITS(size);

	/* Find reinsertion point */
	spin_lock_irqsave(&slob_lock, flags);
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c0104609:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010460c:	8b 40 04             	mov    0x4(%eax),%eax
c010460f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104612:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104615:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0104618:	76 d1                	jbe    c01045eb <slob_free+0x3f>
c010461a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010461d:	8b 40 04             	mov    0x4(%eax),%eax
c0104620:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0104623:	76 c6                	jbe    c01045eb <slob_free+0x3f>
		if (cur >= cur->next && (b > cur || b < cur->next))
			break;

	if (b + b->units == cur->next) {
c0104625:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104628:	8b 00                	mov    (%eax),%eax
c010462a:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0104631:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104634:	01 c2                	add    %eax,%edx
c0104636:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104639:	8b 40 04             	mov    0x4(%eax),%eax
c010463c:	39 c2                	cmp    %eax,%edx
c010463e:	75 25                	jne    c0104665 <slob_free+0xb9>
		b->units += cur->next->units;
c0104640:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104643:	8b 10                	mov    (%eax),%edx
c0104645:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104648:	8b 40 04             	mov    0x4(%eax),%eax
c010464b:	8b 00                	mov    (%eax),%eax
c010464d:	01 c2                	add    %eax,%edx
c010464f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104652:	89 10                	mov    %edx,(%eax)
		b->next = cur->next->next;
c0104654:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104657:	8b 40 04             	mov    0x4(%eax),%eax
c010465a:	8b 50 04             	mov    0x4(%eax),%edx
c010465d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104660:	89 50 04             	mov    %edx,0x4(%eax)
c0104663:	eb 0c                	jmp    c0104671 <slob_free+0xc5>
	} else
		b->next = cur->next;
c0104665:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104668:	8b 50 04             	mov    0x4(%eax),%edx
c010466b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010466e:	89 50 04             	mov    %edx,0x4(%eax)

	if (cur + cur->units == b) {
c0104671:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104674:	8b 00                	mov    (%eax),%eax
c0104676:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c010467d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104680:	01 d0                	add    %edx,%eax
c0104682:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0104685:	75 1f                	jne    c01046a6 <slob_free+0xfa>
		cur->units += b->units;
c0104687:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010468a:	8b 10                	mov    (%eax),%edx
c010468c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010468f:	8b 00                	mov    (%eax),%eax
c0104691:	01 c2                	add    %eax,%edx
c0104693:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104696:	89 10                	mov    %edx,(%eax)
		cur->next = b->next;
c0104698:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010469b:	8b 50 04             	mov    0x4(%eax),%edx
c010469e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01046a1:	89 50 04             	mov    %edx,0x4(%eax)
c01046a4:	eb 09                	jmp    c01046af <slob_free+0x103>
	} else
		cur->next = b;
c01046a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01046a9:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01046ac:	89 50 04             	mov    %edx,0x4(%eax)

	slobfree = cur;
c01046af:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01046b2:	a3 08 4a 12 c0       	mov    %eax,0xc0124a08

	spin_unlock_irqrestore(&slob_lock, flags);
c01046b7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01046ba:	89 04 24             	mov    %eax,(%esp)
c01046bd:	e8 88 fb ff ff       	call   c010424a <__intr_restore>
}
c01046c2:	c9                   	leave  
c01046c3:	c3                   	ret    

c01046c4 <slob_init>:



void
slob_init(void) {
c01046c4:	55                   	push   %ebp
c01046c5:	89 e5                	mov    %esp,%ebp
c01046c7:	83 ec 18             	sub    $0x18,%esp
  cprintf("use SLOB allocator\n");
c01046ca:	c7 04 24 2a a8 10 c0 	movl   $0xc010a82a,(%esp)
c01046d1:	e8 7d bc ff ff       	call   c0100353 <cprintf>
}
c01046d6:	c9                   	leave  
c01046d7:	c3                   	ret    

c01046d8 <kmalloc_init>:

inline void 
kmalloc_init(void) {
c01046d8:	55                   	push   %ebp
c01046d9:	89 e5                	mov    %esp,%ebp
c01046db:	83 ec 18             	sub    $0x18,%esp
    slob_init();
c01046de:	e8 e1 ff ff ff       	call   c01046c4 <slob_init>
    cprintf("kmalloc_init() succeeded!\n");
c01046e3:	c7 04 24 3e a8 10 c0 	movl   $0xc010a83e,(%esp)
c01046ea:	e8 64 bc ff ff       	call   c0100353 <cprintf>
}
c01046ef:	c9                   	leave  
c01046f0:	c3                   	ret    

c01046f1 <slob_allocated>:

size_t
slob_allocated(void) {
c01046f1:	55                   	push   %ebp
c01046f2:	89 e5                	mov    %esp,%ebp
  return 0;
c01046f4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01046f9:	5d                   	pop    %ebp
c01046fa:	c3                   	ret    

c01046fb <kallocated>:

size_t
kallocated(void) {
c01046fb:	55                   	push   %ebp
c01046fc:	89 e5                	mov    %esp,%ebp
   return slob_allocated();
c01046fe:	e8 ee ff ff ff       	call   c01046f1 <slob_allocated>
}
c0104703:	5d                   	pop    %ebp
c0104704:	c3                   	ret    

c0104705 <find_order>:

static int find_order(int size)
{
c0104705:	55                   	push   %ebp
c0104706:	89 e5                	mov    %esp,%ebp
c0104708:	83 ec 10             	sub    $0x10,%esp
	int order = 0;
c010470b:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c0104712:	eb 07                	jmp    c010471b <find_order+0x16>
		order++;
c0104714:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
}

static int find_order(int size)
{
	int order = 0;
	for ( ; size > 4096 ; size >>=1)
c0104718:	d1 7d 08             	sarl   0x8(%ebp)
c010471b:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c0104722:	7f f0                	jg     c0104714 <find_order+0xf>
		order++;
	return order;
c0104724:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0104727:	c9                   	leave  
c0104728:	c3                   	ret    

c0104729 <__kmalloc>:

static void *__kmalloc(size_t size, gfp_t gfp)
{
c0104729:	55                   	push   %ebp
c010472a:	89 e5                	mov    %esp,%ebp
c010472c:	83 ec 28             	sub    $0x28,%esp
	slob_t *m;
	bigblock_t *bb;
	unsigned long flags;

	if (size < PAGE_SIZE - SLOB_UNIT) {
c010472f:	81 7d 08 f7 0f 00 00 	cmpl   $0xff7,0x8(%ebp)
c0104736:	77 38                	ja     c0104770 <__kmalloc+0x47>
		m = slob_alloc(size + SLOB_UNIT, gfp, 0);
c0104738:	8b 45 08             	mov    0x8(%ebp),%eax
c010473b:	8d 50 08             	lea    0x8(%eax),%edx
c010473e:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104745:	00 
c0104746:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104749:	89 44 24 04          	mov    %eax,0x4(%esp)
c010474d:	89 14 24             	mov    %edx,(%esp)
c0104750:	e8 82 fc ff ff       	call   c01043d7 <slob_alloc>
c0104755:	89 45 f4             	mov    %eax,-0xc(%ebp)
		return m ? (void *)(m + 1) : 0;
c0104758:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010475c:	74 08                	je     c0104766 <__kmalloc+0x3d>
c010475e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104761:	83 c0 08             	add    $0x8,%eax
c0104764:	eb 05                	jmp    c010476b <__kmalloc+0x42>
c0104766:	b8 00 00 00 00       	mov    $0x0,%eax
c010476b:	e9 a6 00 00 00       	jmp    c0104816 <__kmalloc+0xed>
	}

	bb = slob_alloc(sizeof(bigblock_t), gfp, 0);
c0104770:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104777:	00 
c0104778:	8b 45 0c             	mov    0xc(%ebp),%eax
c010477b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010477f:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
c0104786:	e8 4c fc ff ff       	call   c01043d7 <slob_alloc>
c010478b:	89 45 f0             	mov    %eax,-0x10(%ebp)
	if (!bb)
c010478e:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104792:	75 07                	jne    c010479b <__kmalloc+0x72>
		return 0;
c0104794:	b8 00 00 00 00       	mov    $0x0,%eax
c0104799:	eb 7b                	jmp    c0104816 <__kmalloc+0xed>

	bb->order = find_order(size);
c010479b:	8b 45 08             	mov    0x8(%ebp),%eax
c010479e:	89 04 24             	mov    %eax,(%esp)
c01047a1:	e8 5f ff ff ff       	call   c0104705 <find_order>
c01047a6:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01047a9:	89 02                	mov    %eax,(%edx)
	bb->pages = (void *)__slob_get_free_pages(gfp, bb->order);
c01047ab:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01047ae:	8b 00                	mov    (%eax),%eax
c01047b0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01047b4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01047b7:	89 04 24             	mov    %eax,(%esp)
c01047ba:	e8 ab fb ff ff       	call   c010436a <__slob_get_free_pages>
c01047bf:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01047c2:	89 42 04             	mov    %eax,0x4(%edx)

	if (bb->pages) {
c01047c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01047c8:	8b 40 04             	mov    0x4(%eax),%eax
c01047cb:	85 c0                	test   %eax,%eax
c01047cd:	74 2f                	je     c01047fe <__kmalloc+0xd5>
		spin_lock_irqsave(&block_lock, flags);
c01047cf:	e8 4c fa ff ff       	call   c0104220 <__intr_save>
c01047d4:	89 45 ec             	mov    %eax,-0x14(%ebp)
		bb->next = bigblocks;
c01047d7:	8b 15 24 5a 12 c0    	mov    0xc0125a24,%edx
c01047dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01047e0:	89 50 08             	mov    %edx,0x8(%eax)
		bigblocks = bb;
c01047e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01047e6:	a3 24 5a 12 c0       	mov    %eax,0xc0125a24
		spin_unlock_irqrestore(&block_lock, flags);
c01047eb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01047ee:	89 04 24             	mov    %eax,(%esp)
c01047f1:	e8 54 fa ff ff       	call   c010424a <__intr_restore>
		return bb->pages;
c01047f6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01047f9:	8b 40 04             	mov    0x4(%eax),%eax
c01047fc:	eb 18                	jmp    c0104816 <__kmalloc+0xed>
	}

	slob_free(bb, sizeof(bigblock_t));
c01047fe:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c0104805:	00 
c0104806:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104809:	89 04 24             	mov    %eax,(%esp)
c010480c:	e8 9b fd ff ff       	call   c01045ac <slob_free>
	return 0;
c0104811:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104816:	c9                   	leave  
c0104817:	c3                   	ret    

c0104818 <kmalloc>:

void *
kmalloc(size_t size)
{
c0104818:	55                   	push   %ebp
c0104819:	89 e5                	mov    %esp,%ebp
c010481b:	83 ec 18             	sub    $0x18,%esp
  return __kmalloc(size, 0);
c010481e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104825:	00 
c0104826:	8b 45 08             	mov    0x8(%ebp),%eax
c0104829:	89 04 24             	mov    %eax,(%esp)
c010482c:	e8 f8 fe ff ff       	call   c0104729 <__kmalloc>
}
c0104831:	c9                   	leave  
c0104832:	c3                   	ret    

c0104833 <kfree>:


void kfree(void *block)
{
c0104833:	55                   	push   %ebp
c0104834:	89 e5                	mov    %esp,%ebp
c0104836:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb, **last = &bigblocks;
c0104839:	c7 45 f0 24 5a 12 c0 	movl   $0xc0125a24,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c0104840:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104844:	75 05                	jne    c010484b <kfree+0x18>
		return;
c0104846:	e9 a2 00 00 00       	jmp    c01048ed <kfree+0xba>

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c010484b:	8b 45 08             	mov    0x8(%ebp),%eax
c010484e:	25 ff 0f 00 00       	and    $0xfff,%eax
c0104853:	85 c0                	test   %eax,%eax
c0104855:	75 7f                	jne    c01048d6 <kfree+0xa3>
		/* might be on the big block list */
		spin_lock_irqsave(&block_lock, flags);
c0104857:	e8 c4 f9 ff ff       	call   c0104220 <__intr_save>
c010485c:	89 45 ec             	mov    %eax,-0x14(%ebp)
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c010485f:	a1 24 5a 12 c0       	mov    0xc0125a24,%eax
c0104864:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104867:	eb 5c                	jmp    c01048c5 <kfree+0x92>
			if (bb->pages == block) {
c0104869:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010486c:	8b 40 04             	mov    0x4(%eax),%eax
c010486f:	3b 45 08             	cmp    0x8(%ebp),%eax
c0104872:	75 3f                	jne    c01048b3 <kfree+0x80>
				*last = bb->next;
c0104874:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104877:	8b 50 08             	mov    0x8(%eax),%edx
c010487a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010487d:	89 10                	mov    %edx,(%eax)
				spin_unlock_irqrestore(&block_lock, flags);
c010487f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104882:	89 04 24             	mov    %eax,(%esp)
c0104885:	e8 c0 f9 ff ff       	call   c010424a <__intr_restore>
				__slob_free_pages((unsigned long)block, bb->order);
c010488a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010488d:	8b 10                	mov    (%eax),%edx
c010488f:	8b 45 08             	mov    0x8(%ebp),%eax
c0104892:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104896:	89 04 24             	mov    %eax,(%esp)
c0104899:	e8 05 fb ff ff       	call   c01043a3 <__slob_free_pages>
				slob_free(bb, sizeof(bigblock_t));
c010489e:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c01048a5:	00 
c01048a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01048a9:	89 04 24             	mov    %eax,(%esp)
c01048ac:	e8 fb fc ff ff       	call   c01045ac <slob_free>
				return;
c01048b1:	eb 3a                	jmp    c01048ed <kfree+0xba>
		return;

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
		/* might be on the big block list */
		spin_lock_irqsave(&block_lock, flags);
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c01048b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01048b6:	83 c0 08             	add    $0x8,%eax
c01048b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01048bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01048bf:	8b 40 08             	mov    0x8(%eax),%eax
c01048c2:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01048c5:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01048c9:	75 9e                	jne    c0104869 <kfree+0x36>
				__slob_free_pages((unsigned long)block, bb->order);
				slob_free(bb, sizeof(bigblock_t));
				return;
			}
		}
		spin_unlock_irqrestore(&block_lock, flags);
c01048cb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01048ce:	89 04 24             	mov    %eax,(%esp)
c01048d1:	e8 74 f9 ff ff       	call   c010424a <__intr_restore>
	}

	slob_free((slob_t *)block - 1, 0);
c01048d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01048d9:	83 e8 08             	sub    $0x8,%eax
c01048dc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01048e3:	00 
c01048e4:	89 04 24             	mov    %eax,(%esp)
c01048e7:	e8 c0 fc ff ff       	call   c01045ac <slob_free>
	return;
c01048ec:	90                   	nop
}
c01048ed:	c9                   	leave  
c01048ee:	c3                   	ret    

c01048ef <ksize>:


unsigned int ksize(const void *block)
{
c01048ef:	55                   	push   %ebp
c01048f0:	89 e5                	mov    %esp,%ebp
c01048f2:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb;
	unsigned long flags;

	if (!block)
c01048f5:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01048f9:	75 07                	jne    c0104902 <ksize+0x13>
		return 0;
c01048fb:	b8 00 00 00 00       	mov    $0x0,%eax
c0104900:	eb 6b                	jmp    c010496d <ksize+0x7e>

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0104902:	8b 45 08             	mov    0x8(%ebp),%eax
c0104905:	25 ff 0f 00 00       	and    $0xfff,%eax
c010490a:	85 c0                	test   %eax,%eax
c010490c:	75 54                	jne    c0104962 <ksize+0x73>
		spin_lock_irqsave(&block_lock, flags);
c010490e:	e8 0d f9 ff ff       	call   c0104220 <__intr_save>
c0104913:	89 45 f0             	mov    %eax,-0x10(%ebp)
		for (bb = bigblocks; bb; bb = bb->next)
c0104916:	a1 24 5a 12 c0       	mov    0xc0125a24,%eax
c010491b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010491e:	eb 31                	jmp    c0104951 <ksize+0x62>
			if (bb->pages == block) {
c0104920:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104923:	8b 40 04             	mov    0x4(%eax),%eax
c0104926:	3b 45 08             	cmp    0x8(%ebp),%eax
c0104929:	75 1d                	jne    c0104948 <ksize+0x59>
				spin_unlock_irqrestore(&slob_lock, flags);
c010492b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010492e:	89 04 24             	mov    %eax,(%esp)
c0104931:	e8 14 f9 ff ff       	call   c010424a <__intr_restore>
				return PAGE_SIZE << bb->order;
c0104936:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104939:	8b 00                	mov    (%eax),%eax
c010493b:	ba 00 10 00 00       	mov    $0x1000,%edx
c0104940:	89 c1                	mov    %eax,%ecx
c0104942:	d3 e2                	shl    %cl,%edx
c0104944:	89 d0                	mov    %edx,%eax
c0104946:	eb 25                	jmp    c010496d <ksize+0x7e>
	if (!block)
		return 0;

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
		spin_lock_irqsave(&block_lock, flags);
		for (bb = bigblocks; bb; bb = bb->next)
c0104948:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010494b:	8b 40 08             	mov    0x8(%eax),%eax
c010494e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104951:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104955:	75 c9                	jne    c0104920 <ksize+0x31>
			if (bb->pages == block) {
				spin_unlock_irqrestore(&slob_lock, flags);
				return PAGE_SIZE << bb->order;
			}
		spin_unlock_irqrestore(&block_lock, flags);
c0104957:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010495a:	89 04 24             	mov    %eax,(%esp)
c010495d:	e8 e8 f8 ff ff       	call   c010424a <__intr_restore>
	}

	return ((slob_t *)block - 1)->units * SLOB_UNIT;
c0104962:	8b 45 08             	mov    0x8(%ebp),%eax
c0104965:	83 e8 08             	sub    $0x8,%eax
c0104968:	8b 00                	mov    (%eax),%eax
c010496a:	c1 e0 03             	shl    $0x3,%eax
}
c010496d:	c9                   	leave  
c010496e:	c3                   	ret    

c010496f <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c010496f:	55                   	push   %ebp
c0104970:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0104972:	8b 55 08             	mov    0x8(%ebp),%edx
c0104975:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c010497a:	29 c2                	sub    %eax,%edx
c010497c:	89 d0                	mov    %edx,%eax
c010497e:	c1 f8 05             	sar    $0x5,%eax
}
c0104981:	5d                   	pop    %ebp
c0104982:	c3                   	ret    

c0104983 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c0104983:	55                   	push   %ebp
c0104984:	89 e5                	mov    %esp,%ebp
c0104986:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0104989:	8b 45 08             	mov    0x8(%ebp),%eax
c010498c:	89 04 24             	mov    %eax,(%esp)
c010498f:	e8 db ff ff ff       	call   c010496f <page2ppn>
c0104994:	c1 e0 0c             	shl    $0xc,%eax
}
c0104997:	c9                   	leave  
c0104998:	c3                   	ret    

c0104999 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c0104999:	55                   	push   %ebp
c010499a:	89 e5                	mov    %esp,%ebp
c010499c:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c010499f:	8b 45 08             	mov    0x8(%ebp),%eax
c01049a2:	c1 e8 0c             	shr    $0xc,%eax
c01049a5:	89 c2                	mov    %eax,%edx
c01049a7:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01049ac:	39 c2                	cmp    %eax,%edx
c01049ae:	72 1c                	jb     c01049cc <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01049b0:	c7 44 24 08 5c a8 10 	movl   $0xc010a85c,0x8(%esp)
c01049b7:	c0 
c01049b8:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01049bf:	00 
c01049c0:	c7 04 24 7b a8 10 c0 	movl   $0xc010a87b,(%esp)
c01049c7:	e8 57 c2 ff ff       	call   c0100c23 <__panic>
    }
    return &pages[PPN(pa)];
c01049cc:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c01049d1:	8b 55 08             	mov    0x8(%ebp),%edx
c01049d4:	c1 ea 0c             	shr    $0xc,%edx
c01049d7:	c1 e2 05             	shl    $0x5,%edx
c01049da:	01 d0                	add    %edx,%eax
}
c01049dc:	c9                   	leave  
c01049dd:	c3                   	ret    

c01049de <page2kva>:

static inline void *
page2kva(struct Page *page) {
c01049de:	55                   	push   %ebp
c01049df:	89 e5                	mov    %esp,%ebp
c01049e1:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01049e4:	8b 45 08             	mov    0x8(%ebp),%eax
c01049e7:	89 04 24             	mov    %eax,(%esp)
c01049ea:	e8 94 ff ff ff       	call   c0104983 <page2pa>
c01049ef:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01049f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01049f5:	c1 e8 0c             	shr    $0xc,%eax
c01049f8:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01049fb:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0104a00:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104a03:	72 23                	jb     c0104a28 <page2kva+0x4a>
c0104a05:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104a08:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104a0c:	c7 44 24 08 8c a8 10 	movl   $0xc010a88c,0x8(%esp)
c0104a13:	c0 
c0104a14:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0104a1b:	00 
c0104a1c:	c7 04 24 7b a8 10 c0 	movl   $0xc010a87b,(%esp)
c0104a23:	e8 fb c1 ff ff       	call   c0100c23 <__panic>
c0104a28:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104a2b:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0104a30:	c9                   	leave  
c0104a31:	c3                   	ret    

c0104a32 <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c0104a32:	55                   	push   %ebp
c0104a33:	89 e5                	mov    %esp,%ebp
c0104a35:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c0104a38:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a3b:	83 e0 01             	and    $0x1,%eax
c0104a3e:	85 c0                	test   %eax,%eax
c0104a40:	75 1c                	jne    c0104a5e <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0104a42:	c7 44 24 08 b0 a8 10 	movl   $0xc010a8b0,0x8(%esp)
c0104a49:	c0 
c0104a4a:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0104a51:	00 
c0104a52:	c7 04 24 7b a8 10 c0 	movl   $0xc010a87b,(%esp)
c0104a59:	e8 c5 c1 ff ff       	call   c0100c23 <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c0104a5e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a61:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104a66:	89 04 24             	mov    %eax,(%esp)
c0104a69:	e8 2b ff ff ff       	call   c0104999 <pa2page>
}
c0104a6e:	c9                   	leave  
c0104a6f:	c3                   	ret    

c0104a70 <page_ref>:
pde2page(pde_t pde) {
    return pa2page(PDE_ADDR(pde));
}

static inline int
page_ref(struct Page *page) {
c0104a70:	55                   	push   %ebp
c0104a71:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0104a73:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a76:	8b 00                	mov    (%eax),%eax
}
c0104a78:	5d                   	pop    %ebp
c0104a79:	c3                   	ret    

c0104a7a <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c0104a7a:	55                   	push   %ebp
c0104a7b:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c0104a7d:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a80:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104a83:	89 10                	mov    %edx,(%eax)
}
c0104a85:	5d                   	pop    %ebp
c0104a86:	c3                   	ret    

c0104a87 <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c0104a87:	55                   	push   %ebp
c0104a88:	89 e5                	mov    %esp,%ebp
    page->ref += 1;
c0104a8a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a8d:	8b 00                	mov    (%eax),%eax
c0104a8f:	8d 50 01             	lea    0x1(%eax),%edx
c0104a92:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a95:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0104a97:	8b 45 08             	mov    0x8(%ebp),%eax
c0104a9a:	8b 00                	mov    (%eax),%eax
}
c0104a9c:	5d                   	pop    %ebp
c0104a9d:	c3                   	ret    

c0104a9e <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c0104a9e:	55                   	push   %ebp
c0104a9f:	89 e5                	mov    %esp,%ebp
    page->ref -= 1;
c0104aa1:	8b 45 08             	mov    0x8(%ebp),%eax
c0104aa4:	8b 00                	mov    (%eax),%eax
c0104aa6:	8d 50 ff             	lea    -0x1(%eax),%edx
c0104aa9:	8b 45 08             	mov    0x8(%ebp),%eax
c0104aac:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0104aae:	8b 45 08             	mov    0x8(%ebp),%eax
c0104ab1:	8b 00                	mov    (%eax),%eax
}
c0104ab3:	5d                   	pop    %ebp
c0104ab4:	c3                   	ret    

c0104ab5 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0104ab5:	55                   	push   %ebp
c0104ab6:	89 e5                	mov    %esp,%ebp
c0104ab8:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0104abb:	9c                   	pushf  
c0104abc:	58                   	pop    %eax
c0104abd:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0104ac0:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0104ac3:	25 00 02 00 00       	and    $0x200,%eax
c0104ac8:	85 c0                	test   %eax,%eax
c0104aca:	74 0c                	je     c0104ad8 <__intr_save+0x23>
        intr_disable();
c0104acc:	e8 aa d3 ff ff       	call   c0101e7b <intr_disable>
        return 1;
c0104ad1:	b8 01 00 00 00       	mov    $0x1,%eax
c0104ad6:	eb 05                	jmp    c0104add <__intr_save+0x28>
    }
    return 0;
c0104ad8:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104add:	c9                   	leave  
c0104ade:	c3                   	ret    

c0104adf <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0104adf:	55                   	push   %ebp
c0104ae0:	89 e5                	mov    %esp,%ebp
c0104ae2:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0104ae5:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104ae9:	74 05                	je     c0104af0 <__intr_restore+0x11>
        intr_enable();
c0104aeb:	e8 85 d3 ff ff       	call   c0101e75 <intr_enable>
    }
}
c0104af0:	c9                   	leave  
c0104af1:	c3                   	ret    

c0104af2 <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c0104af2:	55                   	push   %ebp
c0104af3:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c0104af5:	8b 45 08             	mov    0x8(%ebp),%eax
c0104af8:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c0104afb:	b8 23 00 00 00       	mov    $0x23,%eax
c0104b00:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c0104b02:	b8 23 00 00 00       	mov    $0x23,%eax
c0104b07:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c0104b09:	b8 10 00 00 00       	mov    $0x10,%eax
c0104b0e:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c0104b10:	b8 10 00 00 00       	mov    $0x10,%eax
c0104b15:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c0104b17:	b8 10 00 00 00       	mov    $0x10,%eax
c0104b1c:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c0104b1e:	ea 25 4b 10 c0 08 00 	ljmp   $0x8,$0xc0104b25
}
c0104b25:	5d                   	pop    %ebp
c0104b26:	c3                   	ret    

c0104b27 <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c0104b27:	55                   	push   %ebp
c0104b28:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c0104b2a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104b2d:	a3 64 5a 12 c0       	mov    %eax,0xc0125a64
}
c0104b32:	5d                   	pop    %ebp
c0104b33:	c3                   	ret    

c0104b34 <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c0104b34:	55                   	push   %ebp
c0104b35:	89 e5                	mov    %esp,%ebp
c0104b37:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c0104b3a:	b8 00 40 12 c0       	mov    $0xc0124000,%eax
c0104b3f:	89 04 24             	mov    %eax,(%esp)
c0104b42:	e8 e0 ff ff ff       	call   c0104b27 <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c0104b47:	66 c7 05 68 5a 12 c0 	movw   $0x10,0xc0125a68
c0104b4e:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c0104b50:	66 c7 05 48 4a 12 c0 	movw   $0x68,0xc0124a48
c0104b57:	68 00 
c0104b59:	b8 60 5a 12 c0       	mov    $0xc0125a60,%eax
c0104b5e:	66 a3 4a 4a 12 c0    	mov    %ax,0xc0124a4a
c0104b64:	b8 60 5a 12 c0       	mov    $0xc0125a60,%eax
c0104b69:	c1 e8 10             	shr    $0x10,%eax
c0104b6c:	a2 4c 4a 12 c0       	mov    %al,0xc0124a4c
c0104b71:	0f b6 05 4d 4a 12 c0 	movzbl 0xc0124a4d,%eax
c0104b78:	83 e0 f0             	and    $0xfffffff0,%eax
c0104b7b:	83 c8 09             	or     $0x9,%eax
c0104b7e:	a2 4d 4a 12 c0       	mov    %al,0xc0124a4d
c0104b83:	0f b6 05 4d 4a 12 c0 	movzbl 0xc0124a4d,%eax
c0104b8a:	83 e0 ef             	and    $0xffffffef,%eax
c0104b8d:	a2 4d 4a 12 c0       	mov    %al,0xc0124a4d
c0104b92:	0f b6 05 4d 4a 12 c0 	movzbl 0xc0124a4d,%eax
c0104b99:	83 e0 9f             	and    $0xffffff9f,%eax
c0104b9c:	a2 4d 4a 12 c0       	mov    %al,0xc0124a4d
c0104ba1:	0f b6 05 4d 4a 12 c0 	movzbl 0xc0124a4d,%eax
c0104ba8:	83 c8 80             	or     $0xffffff80,%eax
c0104bab:	a2 4d 4a 12 c0       	mov    %al,0xc0124a4d
c0104bb0:	0f b6 05 4e 4a 12 c0 	movzbl 0xc0124a4e,%eax
c0104bb7:	83 e0 f0             	and    $0xfffffff0,%eax
c0104bba:	a2 4e 4a 12 c0       	mov    %al,0xc0124a4e
c0104bbf:	0f b6 05 4e 4a 12 c0 	movzbl 0xc0124a4e,%eax
c0104bc6:	83 e0 ef             	and    $0xffffffef,%eax
c0104bc9:	a2 4e 4a 12 c0       	mov    %al,0xc0124a4e
c0104bce:	0f b6 05 4e 4a 12 c0 	movzbl 0xc0124a4e,%eax
c0104bd5:	83 e0 df             	and    $0xffffffdf,%eax
c0104bd8:	a2 4e 4a 12 c0       	mov    %al,0xc0124a4e
c0104bdd:	0f b6 05 4e 4a 12 c0 	movzbl 0xc0124a4e,%eax
c0104be4:	83 c8 40             	or     $0x40,%eax
c0104be7:	a2 4e 4a 12 c0       	mov    %al,0xc0124a4e
c0104bec:	0f b6 05 4e 4a 12 c0 	movzbl 0xc0124a4e,%eax
c0104bf3:	83 e0 7f             	and    $0x7f,%eax
c0104bf6:	a2 4e 4a 12 c0       	mov    %al,0xc0124a4e
c0104bfb:	b8 60 5a 12 c0       	mov    $0xc0125a60,%eax
c0104c00:	c1 e8 18             	shr    $0x18,%eax
c0104c03:	a2 4f 4a 12 c0       	mov    %al,0xc0124a4f

    // reload all segment registers
    lgdt(&gdt_pd);
c0104c08:	c7 04 24 50 4a 12 c0 	movl   $0xc0124a50,(%esp)
c0104c0f:	e8 de fe ff ff       	call   c0104af2 <lgdt>
c0104c14:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("cli" ::: "memory");
}

static inline void
ltr(uint16_t sel) {
    asm volatile ("ltr %0" :: "r" (sel) : "memory");
c0104c1a:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0104c1e:	0f 00 d8             	ltr    %ax

    // load the TSS
    ltr(GD_TSS);
}
c0104c21:	c9                   	leave  
c0104c22:	c3                   	ret    

c0104c23 <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c0104c23:	55                   	push   %ebp
c0104c24:	89 e5                	mov    %esp,%ebp
c0104c26:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &default_pmm_manager;
c0104c29:	c7 05 24 7b 12 c0 50 	movl   $0xc010a750,0xc0127b24
c0104c30:	a7 10 c0 
    cprintf("memory management: %s\n", pmm_manager->name);
c0104c33:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104c38:	8b 00                	mov    (%eax),%eax
c0104c3a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104c3e:	c7 04 24 dc a8 10 c0 	movl   $0xc010a8dc,(%esp)
c0104c45:	e8 09 b7 ff ff       	call   c0100353 <cprintf>
    pmm_manager->init();
c0104c4a:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104c4f:	8b 40 04             	mov    0x4(%eax),%eax
c0104c52:	ff d0                	call   *%eax
}
c0104c54:	c9                   	leave  
c0104c55:	c3                   	ret    

c0104c56 <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0104c56:	55                   	push   %ebp
c0104c57:	89 e5                	mov    %esp,%ebp
c0104c59:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c0104c5c:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104c61:	8b 40 08             	mov    0x8(%eax),%eax
c0104c64:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104c67:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104c6b:	8b 55 08             	mov    0x8(%ebp),%edx
c0104c6e:	89 14 24             	mov    %edx,(%esp)
c0104c71:	ff d0                	call   *%eax
}
c0104c73:	c9                   	leave  
c0104c74:	c3                   	ret    

c0104c75 <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0104c75:	55                   	push   %ebp
c0104c76:	89 e5                	mov    %esp,%ebp
c0104c78:	83 ec 28             	sub    $0x28,%esp
    struct Page *page=NULL;
c0104c7b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    
    while (1)
    {
         local_intr_save(intr_flag);
c0104c82:	e8 2e fe ff ff       	call   c0104ab5 <__intr_save>
c0104c87:	89 45 f0             	mov    %eax,-0x10(%ebp)
         {
              page = pmm_manager->alloc_pages(n);
c0104c8a:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104c8f:	8b 40 0c             	mov    0xc(%eax),%eax
c0104c92:	8b 55 08             	mov    0x8(%ebp),%edx
c0104c95:	89 14 24             	mov    %edx,(%esp)
c0104c98:	ff d0                	call   *%eax
c0104c9a:	89 45 f4             	mov    %eax,-0xc(%ebp)
         }
         local_intr_restore(intr_flag);
c0104c9d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104ca0:	89 04 24             	mov    %eax,(%esp)
c0104ca3:	e8 37 fe ff ff       	call   c0104adf <__intr_restore>

         if (page != NULL || n > 1 || swap_init_ok == 0) break;
c0104ca8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104cac:	75 2d                	jne    c0104cdb <alloc_pages+0x66>
c0104cae:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c0104cb2:	77 27                	ja     c0104cdb <alloc_pages+0x66>
c0104cb4:	a1 cc 5a 12 c0       	mov    0xc0125acc,%eax
c0104cb9:	85 c0                	test   %eax,%eax
c0104cbb:	74 1e                	je     c0104cdb <alloc_pages+0x66>
         
         extern struct mm_struct *check_mm_struct;
         //cprintf("page %x, call swap_out in alloc_pages %d\n",page, n);
         swap_out(check_mm_struct, n, 0);
c0104cbd:	8b 55 08             	mov    0x8(%ebp),%edx
c0104cc0:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c0104cc5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104ccc:	00 
c0104ccd:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104cd1:	89 04 24             	mov    %eax,(%esp)
c0104cd4:	e8 62 19 00 00       	call   c010663b <swap_out>
    }
c0104cd9:	eb a7                	jmp    c0104c82 <alloc_pages+0xd>
    //cprintf("n %d,get page %x, No %d in alloc_pages\n",n,page,(page-pages));
    return page;
c0104cdb:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0104cde:	c9                   	leave  
c0104cdf:	c3                   	ret    

c0104ce0 <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c0104ce0:	55                   	push   %ebp
c0104ce1:	89 e5                	mov    %esp,%ebp
c0104ce3:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0104ce6:	e8 ca fd ff ff       	call   c0104ab5 <__intr_save>
c0104ceb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c0104cee:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104cf3:	8b 40 10             	mov    0x10(%eax),%eax
c0104cf6:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104cf9:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104cfd:	8b 55 08             	mov    0x8(%ebp),%edx
c0104d00:	89 14 24             	mov    %edx,(%esp)
c0104d03:	ff d0                	call   *%eax
    }
    local_intr_restore(intr_flag);
c0104d05:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d08:	89 04 24             	mov    %eax,(%esp)
c0104d0b:	e8 cf fd ff ff       	call   c0104adf <__intr_restore>
}
c0104d10:	c9                   	leave  
c0104d11:	c3                   	ret    

c0104d12 <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c0104d12:	55                   	push   %ebp
c0104d13:	89 e5                	mov    %esp,%ebp
c0104d15:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c0104d18:	e8 98 fd ff ff       	call   c0104ab5 <__intr_save>
c0104d1d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c0104d20:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c0104d25:	8b 40 14             	mov    0x14(%eax),%eax
c0104d28:	ff d0                	call   *%eax
c0104d2a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c0104d2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d30:	89 04 24             	mov    %eax,(%esp)
c0104d33:	e8 a7 fd ff ff       	call   c0104adf <__intr_restore>
    return ret;
c0104d38:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0104d3b:	c9                   	leave  
c0104d3c:	c3                   	ret    

c0104d3d <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c0104d3d:	55                   	push   %ebp
c0104d3e:	89 e5                	mov    %esp,%ebp
c0104d40:	57                   	push   %edi
c0104d41:	56                   	push   %esi
c0104d42:	53                   	push   %ebx
c0104d43:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c0104d49:	c7 45 c4 00 80 00 c0 	movl   $0xc0008000,-0x3c(%ebp)
    uint64_t maxpa = 0;
c0104d50:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0104d57:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)

    cprintf("e820map:\n");
c0104d5e:	c7 04 24 f3 a8 10 c0 	movl   $0xc010a8f3,(%esp)
c0104d65:	e8 e9 b5 ff ff       	call   c0100353 <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c0104d6a:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0104d71:	e9 15 01 00 00       	jmp    c0104e8b <page_init+0x14e>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0104d76:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104d79:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104d7c:	89 d0                	mov    %edx,%eax
c0104d7e:	c1 e0 02             	shl    $0x2,%eax
c0104d81:	01 d0                	add    %edx,%eax
c0104d83:	c1 e0 02             	shl    $0x2,%eax
c0104d86:	01 c8                	add    %ecx,%eax
c0104d88:	8b 50 08             	mov    0x8(%eax),%edx
c0104d8b:	8b 40 04             	mov    0x4(%eax),%eax
c0104d8e:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0104d91:	89 55 bc             	mov    %edx,-0x44(%ebp)
c0104d94:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104d97:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104d9a:	89 d0                	mov    %edx,%eax
c0104d9c:	c1 e0 02             	shl    $0x2,%eax
c0104d9f:	01 d0                	add    %edx,%eax
c0104da1:	c1 e0 02             	shl    $0x2,%eax
c0104da4:	01 c8                	add    %ecx,%eax
c0104da6:	8b 48 0c             	mov    0xc(%eax),%ecx
c0104da9:	8b 58 10             	mov    0x10(%eax),%ebx
c0104dac:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0104daf:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0104db2:	01 c8                	add    %ecx,%eax
c0104db4:	11 da                	adc    %ebx,%edx
c0104db6:	89 45 b0             	mov    %eax,-0x50(%ebp)
c0104db9:	89 55 b4             	mov    %edx,-0x4c(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c0104dbc:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104dbf:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104dc2:	89 d0                	mov    %edx,%eax
c0104dc4:	c1 e0 02             	shl    $0x2,%eax
c0104dc7:	01 d0                	add    %edx,%eax
c0104dc9:	c1 e0 02             	shl    $0x2,%eax
c0104dcc:	01 c8                	add    %ecx,%eax
c0104dce:	83 c0 14             	add    $0x14,%eax
c0104dd1:	8b 00                	mov    (%eax),%eax
c0104dd3:	89 85 7c ff ff ff    	mov    %eax,-0x84(%ebp)
c0104dd9:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0104ddc:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0104ddf:	83 c0 ff             	add    $0xffffffff,%eax
c0104de2:	83 d2 ff             	adc    $0xffffffff,%edx
c0104de5:	89 c6                	mov    %eax,%esi
c0104de7:	89 d7                	mov    %edx,%edi
c0104de9:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104dec:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104def:	89 d0                	mov    %edx,%eax
c0104df1:	c1 e0 02             	shl    $0x2,%eax
c0104df4:	01 d0                	add    %edx,%eax
c0104df6:	c1 e0 02             	shl    $0x2,%eax
c0104df9:	01 c8                	add    %ecx,%eax
c0104dfb:	8b 48 0c             	mov    0xc(%eax),%ecx
c0104dfe:	8b 58 10             	mov    0x10(%eax),%ebx
c0104e01:	8b 85 7c ff ff ff    	mov    -0x84(%ebp),%eax
c0104e07:	89 44 24 1c          	mov    %eax,0x1c(%esp)
c0104e0b:	89 74 24 14          	mov    %esi,0x14(%esp)
c0104e0f:	89 7c 24 18          	mov    %edi,0x18(%esp)
c0104e13:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0104e16:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0104e19:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104e1d:	89 54 24 10          	mov    %edx,0x10(%esp)
c0104e21:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0104e25:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c0104e29:	c7 04 24 00 a9 10 c0 	movl   $0xc010a900,(%esp)
c0104e30:	e8 1e b5 ff ff       	call   c0100353 <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0104e35:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104e38:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104e3b:	89 d0                	mov    %edx,%eax
c0104e3d:	c1 e0 02             	shl    $0x2,%eax
c0104e40:	01 d0                	add    %edx,%eax
c0104e42:	c1 e0 02             	shl    $0x2,%eax
c0104e45:	01 c8                	add    %ecx,%eax
c0104e47:	83 c0 14             	add    $0x14,%eax
c0104e4a:	8b 00                	mov    (%eax),%eax
c0104e4c:	83 f8 01             	cmp    $0x1,%eax
c0104e4f:	75 36                	jne    c0104e87 <page_init+0x14a>
            if (maxpa < end && begin < KMEMSIZE) {
c0104e51:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104e54:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104e57:	3b 55 b4             	cmp    -0x4c(%ebp),%edx
c0104e5a:	77 2b                	ja     c0104e87 <page_init+0x14a>
c0104e5c:	3b 55 b4             	cmp    -0x4c(%ebp),%edx
c0104e5f:	72 05                	jb     c0104e66 <page_init+0x129>
c0104e61:	3b 45 b0             	cmp    -0x50(%ebp),%eax
c0104e64:	73 21                	jae    c0104e87 <page_init+0x14a>
c0104e66:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0104e6a:	77 1b                	ja     c0104e87 <page_init+0x14a>
c0104e6c:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0104e70:	72 09                	jb     c0104e7b <page_init+0x13e>
c0104e72:	81 7d b8 ff ff ff 37 	cmpl   $0x37ffffff,-0x48(%ebp)
c0104e79:	77 0c                	ja     c0104e87 <page_init+0x14a>
                maxpa = end;
c0104e7b:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0104e7e:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0104e81:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0104e84:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
    uint64_t maxpa = 0;

    cprintf("e820map:\n");
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c0104e87:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c0104e8b:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0104e8e:	8b 00                	mov    (%eax),%eax
c0104e90:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c0104e93:	0f 8f dd fe ff ff    	jg     c0104d76 <page_init+0x39>
            if (maxpa < end && begin < KMEMSIZE) {
                maxpa = end;
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c0104e99:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0104e9d:	72 1d                	jb     c0104ebc <page_init+0x17f>
c0104e9f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0104ea3:	77 09                	ja     c0104eae <page_init+0x171>
c0104ea5:	81 7d e0 00 00 00 38 	cmpl   $0x38000000,-0x20(%ebp)
c0104eac:	76 0e                	jbe    c0104ebc <page_init+0x17f>
        maxpa = KMEMSIZE;
c0104eae:	c7 45 e0 00 00 00 38 	movl   $0x38000000,-0x20(%ebp)
c0104eb5:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c0104ebc:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104ebf:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0104ec2:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0104ec6:	c1 ea 0c             	shr    $0xc,%edx
c0104ec9:	a3 40 5a 12 c0       	mov    %eax,0xc0125a40
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c0104ece:	c7 45 ac 00 10 00 00 	movl   $0x1000,-0x54(%ebp)
c0104ed5:	b8 18 7c 12 c0       	mov    $0xc0127c18,%eax
c0104eda:	8d 50 ff             	lea    -0x1(%eax),%edx
c0104edd:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0104ee0:	01 d0                	add    %edx,%eax
c0104ee2:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0104ee5:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0104ee8:	ba 00 00 00 00       	mov    $0x0,%edx
c0104eed:	f7 75 ac             	divl   -0x54(%ebp)
c0104ef0:	89 d0                	mov    %edx,%eax
c0104ef2:	8b 55 a8             	mov    -0x58(%ebp),%edx
c0104ef5:	29 c2                	sub    %eax,%edx
c0104ef7:	89 d0                	mov    %edx,%eax
c0104ef9:	a3 2c 7b 12 c0       	mov    %eax,0xc0127b2c

    for (i = 0; i < npage; i ++) {
c0104efe:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0104f05:	eb 27                	jmp    c0104f2e <page_init+0x1f1>
        SetPageReserved(pages + i);
c0104f07:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c0104f0c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104f0f:	c1 e2 05             	shl    $0x5,%edx
c0104f12:	01 d0                	add    %edx,%eax
c0104f14:	83 c0 04             	add    $0x4,%eax
c0104f17:	c7 45 90 00 00 00 00 	movl   $0x0,-0x70(%ebp)
c0104f1e:	89 45 8c             	mov    %eax,-0x74(%ebp)
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 * */
static inline void
set_bit(int nr, volatile void *addr) {
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0104f21:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0104f24:	8b 55 90             	mov    -0x70(%ebp),%edx
c0104f27:	0f ab 10             	bts    %edx,(%eax)
    extern char end[];

    npage = maxpa / PGSIZE;
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);

    for (i = 0; i < npage; i ++) {
c0104f2a:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c0104f2e:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104f31:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0104f36:	39 c2                	cmp    %eax,%edx
c0104f38:	72 cd                	jb     c0104f07 <page_init+0x1ca>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c0104f3a:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0104f3f:	c1 e0 05             	shl    $0x5,%eax
c0104f42:	89 c2                	mov    %eax,%edx
c0104f44:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c0104f49:	01 d0                	add    %edx,%eax
c0104f4b:	89 45 a4             	mov    %eax,-0x5c(%ebp)
c0104f4e:	81 7d a4 ff ff ff bf 	cmpl   $0xbfffffff,-0x5c(%ebp)
c0104f55:	77 23                	ja     c0104f7a <page_init+0x23d>
c0104f57:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104f5a:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104f5e:	c7 44 24 08 30 a9 10 	movl   $0xc010a930,0x8(%esp)
c0104f65:	c0 
c0104f66:	c7 44 24 04 e9 00 00 	movl   $0xe9,0x4(%esp)
c0104f6d:	00 
c0104f6e:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0104f75:	e8 a9 bc ff ff       	call   c0100c23 <__panic>
c0104f7a:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0104f7d:	05 00 00 00 40       	add    $0x40000000,%eax
c0104f82:	89 45 a0             	mov    %eax,-0x60(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c0104f85:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0104f8c:	e9 74 01 00 00       	jmp    c0105105 <page_init+0x3c8>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0104f91:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104f94:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104f97:	89 d0                	mov    %edx,%eax
c0104f99:	c1 e0 02             	shl    $0x2,%eax
c0104f9c:	01 d0                	add    %edx,%eax
c0104f9e:	c1 e0 02             	shl    $0x2,%eax
c0104fa1:	01 c8                	add    %ecx,%eax
c0104fa3:	8b 50 08             	mov    0x8(%eax),%edx
c0104fa6:	8b 40 04             	mov    0x4(%eax),%eax
c0104fa9:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0104fac:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0104faf:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104fb2:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104fb5:	89 d0                	mov    %edx,%eax
c0104fb7:	c1 e0 02             	shl    $0x2,%eax
c0104fba:	01 d0                	add    %edx,%eax
c0104fbc:	c1 e0 02             	shl    $0x2,%eax
c0104fbf:	01 c8                	add    %ecx,%eax
c0104fc1:	8b 48 0c             	mov    0xc(%eax),%ecx
c0104fc4:	8b 58 10             	mov    0x10(%eax),%ebx
c0104fc7:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0104fca:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0104fcd:	01 c8                	add    %ecx,%eax
c0104fcf:	11 da                	adc    %ebx,%edx
c0104fd1:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0104fd4:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c0104fd7:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0104fda:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0104fdd:	89 d0                	mov    %edx,%eax
c0104fdf:	c1 e0 02             	shl    $0x2,%eax
c0104fe2:	01 d0                	add    %edx,%eax
c0104fe4:	c1 e0 02             	shl    $0x2,%eax
c0104fe7:	01 c8                	add    %ecx,%eax
c0104fe9:	83 c0 14             	add    $0x14,%eax
c0104fec:	8b 00                	mov    (%eax),%eax
c0104fee:	83 f8 01             	cmp    $0x1,%eax
c0104ff1:	0f 85 0a 01 00 00    	jne    c0105101 <page_init+0x3c4>
            if (begin < freemem) {
c0104ff7:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104ffa:	ba 00 00 00 00       	mov    $0x0,%edx
c0104fff:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0105002:	72 17                	jb     c010501b <page_init+0x2de>
c0105004:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0105007:	77 05                	ja     c010500e <page_init+0x2d1>
c0105009:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c010500c:	76 0d                	jbe    c010501b <page_init+0x2de>
                begin = freemem;
c010500e:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0105011:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0105014:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
            }
            if (end > KMEMSIZE) {
c010501b:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c010501f:	72 1d                	jb     c010503e <page_init+0x301>
c0105021:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0105025:	77 09                	ja     c0105030 <page_init+0x2f3>
c0105027:	81 7d c8 00 00 00 38 	cmpl   $0x38000000,-0x38(%ebp)
c010502e:	76 0e                	jbe    c010503e <page_init+0x301>
                end = KMEMSIZE;
c0105030:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c0105037:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c010503e:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105041:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105044:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0105047:	0f 87 b4 00 00 00    	ja     c0105101 <page_init+0x3c4>
c010504d:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c0105050:	72 09                	jb     c010505b <page_init+0x31e>
c0105052:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c0105055:	0f 83 a6 00 00 00    	jae    c0105101 <page_init+0x3c4>
                begin = ROUNDUP(begin, PGSIZE);
c010505b:	c7 45 9c 00 10 00 00 	movl   $0x1000,-0x64(%ebp)
c0105062:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105065:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0105068:	01 d0                	add    %edx,%eax
c010506a:	83 e8 01             	sub    $0x1,%eax
c010506d:	89 45 98             	mov    %eax,-0x68(%ebp)
c0105070:	8b 45 98             	mov    -0x68(%ebp),%eax
c0105073:	ba 00 00 00 00       	mov    $0x0,%edx
c0105078:	f7 75 9c             	divl   -0x64(%ebp)
c010507b:	89 d0                	mov    %edx,%eax
c010507d:	8b 55 98             	mov    -0x68(%ebp),%edx
c0105080:	29 c2                	sub    %eax,%edx
c0105082:	89 d0                	mov    %edx,%eax
c0105084:	ba 00 00 00 00       	mov    $0x0,%edx
c0105089:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010508c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c010508f:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105092:	89 45 94             	mov    %eax,-0x6c(%ebp)
c0105095:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0105098:	ba 00 00 00 00       	mov    $0x0,%edx
c010509d:	89 c7                	mov    %eax,%edi
c010509f:	81 e7 00 f0 ff ff    	and    $0xfffff000,%edi
c01050a5:	89 7d 80             	mov    %edi,-0x80(%ebp)
c01050a8:	89 d0                	mov    %edx,%eax
c01050aa:	83 e0 00             	and    $0x0,%eax
c01050ad:	89 45 84             	mov    %eax,-0x7c(%ebp)
c01050b0:	8b 45 80             	mov    -0x80(%ebp),%eax
c01050b3:	8b 55 84             	mov    -0x7c(%ebp),%edx
c01050b6:	89 45 c8             	mov    %eax,-0x38(%ebp)
c01050b9:	89 55 cc             	mov    %edx,-0x34(%ebp)
                if (begin < end) {
c01050bc:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01050bf:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01050c2:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c01050c5:	77 3a                	ja     c0105101 <page_init+0x3c4>
c01050c7:	3b 55 cc             	cmp    -0x34(%ebp),%edx
c01050ca:	72 05                	jb     c01050d1 <page_init+0x394>
c01050cc:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c01050cf:	73 30                	jae    c0105101 <page_init+0x3c4>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c01050d1:	8b 4d d0             	mov    -0x30(%ebp),%ecx
c01050d4:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
c01050d7:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01050da:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01050dd:	29 c8                	sub    %ecx,%eax
c01050df:	19 da                	sbb    %ebx,%edx
c01050e1:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c01050e5:	c1 ea 0c             	shr    $0xc,%edx
c01050e8:	89 c3                	mov    %eax,%ebx
c01050ea:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01050ed:	89 04 24             	mov    %eax,(%esp)
c01050f0:	e8 a4 f8 ff ff       	call   c0104999 <pa2page>
c01050f5:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c01050f9:	89 04 24             	mov    %eax,(%esp)
c01050fc:	e8 55 fb ff ff       	call   c0104c56 <init_memmap>
        SetPageReserved(pages + i);
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);

    for (i = 0; i < memmap->nr_map; i ++) {
c0105101:	83 45 dc 01          	addl   $0x1,-0x24(%ebp)
c0105105:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0105108:	8b 00                	mov    (%eax),%eax
c010510a:	3b 45 dc             	cmp    -0x24(%ebp),%eax
c010510d:	0f 8f 7e fe ff ff    	jg     c0104f91 <page_init+0x254>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
                }
            }
        }
    }
}
c0105113:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c0105119:	5b                   	pop    %ebx
c010511a:	5e                   	pop    %esi
c010511b:	5f                   	pop    %edi
c010511c:	5d                   	pop    %ebp
c010511d:	c3                   	ret    

c010511e <enable_paging>:

static void
enable_paging(void) {
c010511e:	55                   	push   %ebp
c010511f:	89 e5                	mov    %esp,%ebp
c0105121:	83 ec 10             	sub    $0x10,%esp
    lcr3(boot_cr3);
c0105124:	a1 28 7b 12 c0       	mov    0xc0127b28,%eax
c0105129:	89 45 f8             	mov    %eax,-0x8(%ebp)
    asm volatile ("mov %0, %%cr0" :: "r" (cr0) : "memory");
}

static inline void
lcr3(uintptr_t cr3) {
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c010512c:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010512f:	0f 22 d8             	mov    %eax,%cr3
}

static inline uintptr_t
rcr0(void) {
    uintptr_t cr0;
    asm volatile ("mov %%cr0, %0" : "=r" (cr0) :: "memory");
c0105132:	0f 20 c0             	mov    %cr0,%eax
c0105135:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr0;
c0105138:	8b 45 f4             	mov    -0xc(%ebp),%eax

    // turn on paging
    uint32_t cr0 = rcr0();
c010513b:	89 45 fc             	mov    %eax,-0x4(%ebp)
    cr0 |= CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP;
c010513e:	81 4d fc 2f 00 05 80 	orl    $0x8005002f,-0x4(%ebp)
    cr0 &= ~(CR0_TS | CR0_EM);
c0105145:	83 65 fc f3          	andl   $0xfffffff3,-0x4(%ebp)
c0105149:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010514c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile ("pushl %0; popfl" :: "r" (eflags));
}

static inline void
lcr0(uintptr_t cr0) {
    asm volatile ("mov %0, %%cr0" :: "r" (cr0) : "memory");
c010514f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105152:	0f 22 c0             	mov    %eax,%cr0
    lcr0(cr0);
}
c0105155:	c9                   	leave  
c0105156:	c3                   	ret    

c0105157 <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c0105157:	55                   	push   %ebp
c0105158:	89 e5                	mov    %esp,%ebp
c010515a:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c010515d:	8b 45 14             	mov    0x14(%ebp),%eax
c0105160:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105163:	31 d0                	xor    %edx,%eax
c0105165:	25 ff 0f 00 00       	and    $0xfff,%eax
c010516a:	85 c0                	test   %eax,%eax
c010516c:	74 24                	je     c0105192 <boot_map_segment+0x3b>
c010516e:	c7 44 24 0c 62 a9 10 	movl   $0xc010a962,0xc(%esp)
c0105175:	c0 
c0105176:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c010517d:	c0 
c010517e:	c7 44 24 04 12 01 00 	movl   $0x112,0x4(%esp)
c0105185:	00 
c0105186:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010518d:	e8 91 ba ff ff       	call   c0100c23 <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c0105192:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
c0105199:	8b 45 0c             	mov    0xc(%ebp),%eax
c010519c:	25 ff 0f 00 00       	and    $0xfff,%eax
c01051a1:	89 c2                	mov    %eax,%edx
c01051a3:	8b 45 10             	mov    0x10(%ebp),%eax
c01051a6:	01 c2                	add    %eax,%edx
c01051a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01051ab:	01 d0                	add    %edx,%eax
c01051ad:	83 e8 01             	sub    $0x1,%eax
c01051b0:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01051b3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01051b6:	ba 00 00 00 00       	mov    $0x0,%edx
c01051bb:	f7 75 f0             	divl   -0x10(%ebp)
c01051be:	89 d0                	mov    %edx,%eax
c01051c0:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01051c3:	29 c2                	sub    %eax,%edx
c01051c5:	89 d0                	mov    %edx,%eax
c01051c7:	c1 e8 0c             	shr    $0xc,%eax
c01051ca:	89 45 f4             	mov    %eax,-0xc(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c01051cd:	8b 45 0c             	mov    0xc(%ebp),%eax
c01051d0:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01051d3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01051d6:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01051db:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c01051de:	8b 45 14             	mov    0x14(%ebp),%eax
c01051e1:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01051e4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01051e7:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01051ec:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c01051ef:	eb 6b                	jmp    c010525c <boot_map_segment+0x105>
        pte_t *ptep = get_pte(pgdir, la, 1);
c01051f1:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c01051f8:	00 
c01051f9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01051fc:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105200:	8b 45 08             	mov    0x8(%ebp),%eax
c0105203:	89 04 24             	mov    %eax,(%esp)
c0105206:	e8 d1 01 00 00       	call   c01053dc <get_pte>
c010520b:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ptep != NULL);
c010520e:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0105212:	75 24                	jne    c0105238 <boot_map_segment+0xe1>
c0105214:	c7 44 24 0c 8e a9 10 	movl   $0xc010a98e,0xc(%esp)
c010521b:	c0 
c010521c:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105223:	c0 
c0105224:	c7 44 24 04 18 01 00 	movl   $0x118,0x4(%esp)
c010522b:	00 
c010522c:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105233:	e8 eb b9 ff ff       	call   c0100c23 <__panic>
        *ptep = pa | PTE_P | perm;
c0105238:	8b 45 18             	mov    0x18(%ebp),%eax
c010523b:	8b 55 14             	mov    0x14(%ebp),%edx
c010523e:	09 d0                	or     %edx,%eax
c0105240:	83 c8 01             	or     $0x1,%eax
c0105243:	89 c2                	mov    %eax,%edx
c0105245:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105248:	89 10                	mov    %edx,(%eax)
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
    assert(PGOFF(la) == PGOFF(pa));
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
    la = ROUNDDOWN(la, PGSIZE);
    pa = ROUNDDOWN(pa, PGSIZE);
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c010524a:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c010524e:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0105255:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c010525c:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105260:	75 8f                	jne    c01051f1 <boot_map_segment+0x9a>
        pte_t *ptep = get_pte(pgdir, la, 1);
        assert(ptep != NULL);
        *ptep = pa | PTE_P | perm;
    }
}
c0105262:	c9                   	leave  
c0105263:	c3                   	ret    

c0105264 <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0105264:	55                   	push   %ebp
c0105265:	89 e5                	mov    %esp,%ebp
c0105267:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c010526a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105271:	e8 ff f9 ff ff       	call   c0104c75 <alloc_pages>
c0105276:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c0105279:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010527d:	75 1c                	jne    c010529b <boot_alloc_page+0x37>
        panic("boot_alloc_page failed.\n");
c010527f:	c7 44 24 08 9b a9 10 	movl   $0xc010a99b,0x8(%esp)
c0105286:	c0 
c0105287:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c010528e:	00 
c010528f:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105296:	e8 88 b9 ff ff       	call   c0100c23 <__panic>
    }
    return page2kva(p);
c010529b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010529e:	89 04 24             	mov    %eax,(%esp)
c01052a1:	e8 38 f7 ff ff       	call   c01049de <page2kva>
}
c01052a6:	c9                   	leave  
c01052a7:	c3                   	ret    

c01052a8 <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c01052a8:	55                   	push   %ebp
c01052a9:	89 e5                	mov    %esp,%ebp
c01052ab:	83 ec 38             	sub    $0x38,%esp
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c01052ae:	e8 70 f9 ff ff       	call   c0104c23 <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c01052b3:	e8 85 fa ff ff       	call   c0104d3d <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c01052b8:	e8 36 05 00 00       	call   c01057f3 <check_alloc_page>

    // create boot_pgdir, an initial page directory(Page Directory Table, PDT)
    boot_pgdir = boot_alloc_page();
c01052bd:	e8 a2 ff ff ff       	call   c0105264 <boot_alloc_page>
c01052c2:	a3 44 5a 12 c0       	mov    %eax,0xc0125a44
    memset(boot_pgdir, 0, PGSIZE);
c01052c7:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01052cc:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c01052d3:	00 
c01052d4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01052db:	00 
c01052dc:	89 04 24             	mov    %eax,(%esp)
c01052df:	e8 29 47 00 00       	call   c0109a0d <memset>
    boot_cr3 = PADDR(boot_pgdir);
c01052e4:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01052e9:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01052ec:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01052f3:	77 23                	ja     c0105318 <pmm_init+0x70>
c01052f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01052f8:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01052fc:	c7 44 24 08 30 a9 10 	movl   $0xc010a930,0x8(%esp)
c0105303:	c0 
c0105304:	c7 44 24 04 3e 01 00 	movl   $0x13e,0x4(%esp)
c010530b:	00 
c010530c:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105313:	e8 0b b9 ff ff       	call   c0100c23 <__panic>
c0105318:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010531b:	05 00 00 00 40       	add    $0x40000000,%eax
c0105320:	a3 28 7b 12 c0       	mov    %eax,0xc0127b28

    check_pgdir();
c0105325:	e8 e7 04 00 00       	call   c0105811 <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c010532a:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c010532f:	8d 90 ac 0f 00 00    	lea    0xfac(%eax),%edx
c0105335:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c010533a:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010533d:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c0105344:	77 23                	ja     c0105369 <pmm_init+0xc1>
c0105346:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105349:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010534d:	c7 44 24 08 30 a9 10 	movl   $0xc010a930,0x8(%esp)
c0105354:	c0 
c0105355:	c7 44 24 04 46 01 00 	movl   $0x146,0x4(%esp)
c010535c:	00 
c010535d:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105364:	e8 ba b8 ff ff       	call   c0100c23 <__panic>
c0105369:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010536c:	05 00 00 00 40       	add    $0x40000000,%eax
c0105371:	83 c8 03             	or     $0x3,%eax
c0105374:	89 02                	mov    %eax,(%edx)

    // map all physical memory to linear memory with base linear addr KERNBASE
    //linear_addr KERNBASE~KERNBASE+KMEMSIZE = phy_addr 0~KMEMSIZE
    //But shouldn't use this map until enable_paging() & gdt_init() finished.
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c0105376:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c010537b:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c0105382:	00 
c0105383:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010538a:	00 
c010538b:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c0105392:	38 
c0105393:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c010539a:	c0 
c010539b:	89 04 24             	mov    %eax,(%esp)
c010539e:	e8 b4 fd ff ff       	call   c0105157 <boot_map_segment>

    //temporary map: 
    //virtual_addr 3G~3G+4M = linear_addr 0~4M = linear_addr 3G~3G+4M = phy_addr 0~4M     
    boot_pgdir[0] = boot_pgdir[PDX(KERNBASE)];
c01053a3:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01053a8:	8b 15 44 5a 12 c0    	mov    0xc0125a44,%edx
c01053ae:	8b 92 00 0c 00 00    	mov    0xc00(%edx),%edx
c01053b4:	89 10                	mov    %edx,(%eax)

    enable_paging();
c01053b6:	e8 63 fd ff ff       	call   c010511e <enable_paging>

    //reload gdt(third time,the last time) to map all physical memory
    //virtual_addr 0~4G=liear_addr 0~4G
    //then set kernel stack(ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c01053bb:	e8 74 f7 ff ff       	call   c0104b34 <gdt_init>

    //disable the map of virtual_addr 0~4M
    boot_pgdir[0] = 0;
c01053c0:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01053c5:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c01053cb:	e8 dc 0a 00 00       	call   c0105eac <check_boot_pgdir>

    print_pgdir();
c01053d0:	e8 69 0f 00 00       	call   c010633e <print_pgdir>
    
    kmalloc_init();
c01053d5:	e8 fe f2 ff ff       	call   c01046d8 <kmalloc_init>

}
c01053da:	c9                   	leave  
c01053db:	c3                   	ret    

c01053dc <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c01053dc:	55                   	push   %ebp
c01053dd:	89 e5                	mov    %esp,%ebp
c01053df:	83 ec 38             	sub    $0x38,%esp
                          // (6) clear page content using memset
                          // (7) set page directory entry's permission
    }
    return NULL;          // (8) return page table entry
#endif
    pde_t *pdep = &pgdir[PDX(la)];
c01053e2:	8b 45 0c             	mov    0xc(%ebp),%eax
c01053e5:	c1 e8 16             	shr    $0x16,%eax
c01053e8:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01053ef:	8b 45 08             	mov    0x8(%ebp),%eax
c01053f2:	01 d0                	add    %edx,%eax
c01053f4:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!(*pdep & PTE_P)) {
c01053f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053fa:	8b 00                	mov    (%eax),%eax
c01053fc:	83 e0 01             	and    $0x1,%eax
c01053ff:	85 c0                	test   %eax,%eax
c0105401:	0f 85 af 00 00 00    	jne    c01054b6 <get_pte+0xda>
        struct Page *page;
        if (!create || (page = alloc_page()) == NULL) {
c0105407:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010540b:	74 15                	je     c0105422 <get_pte+0x46>
c010540d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105414:	e8 5c f8 ff ff       	call   c0104c75 <alloc_pages>
c0105419:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010541c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105420:	75 0a                	jne    c010542c <get_pte+0x50>
            return NULL;
c0105422:	b8 00 00 00 00       	mov    $0x0,%eax
c0105427:	e9 e6 00 00 00       	jmp    c0105512 <get_pte+0x136>
        }
        set_page_ref(page, 1);
c010542c:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105433:	00 
c0105434:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105437:	89 04 24             	mov    %eax,(%esp)
c010543a:	e8 3b f6 ff ff       	call   c0104a7a <set_page_ref>
        uintptr_t pa = page2pa(page);
c010543f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105442:	89 04 24             	mov    %eax,(%esp)
c0105445:	e8 39 f5 ff ff       	call   c0104983 <page2pa>
c010544a:	89 45 ec             	mov    %eax,-0x14(%ebp)
        memset(KADDR(pa), 0, PGSIZE);
c010544d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105450:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0105453:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105456:	c1 e8 0c             	shr    $0xc,%eax
c0105459:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010545c:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0105461:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c0105464:	72 23                	jb     c0105489 <get_pte+0xad>
c0105466:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105469:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010546d:	c7 44 24 08 8c a8 10 	movl   $0xc010a88c,0x8(%esp)
c0105474:	c0 
c0105475:	c7 44 24 04 97 01 00 	movl   $0x197,0x4(%esp)
c010547c:	00 
c010547d:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105484:	e8 9a b7 ff ff       	call   c0100c23 <__panic>
c0105489:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010548c:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105491:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0105498:	00 
c0105499:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01054a0:	00 
c01054a1:	89 04 24             	mov    %eax,(%esp)
c01054a4:	e8 64 45 00 00       	call   c0109a0d <memset>
        *pdep = pa | PTE_U | PTE_W | PTE_P;
c01054a9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01054ac:	83 c8 07             	or     $0x7,%eax
c01054af:	89 c2                	mov    %eax,%edx
c01054b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054b4:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];
c01054b6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054b9:	8b 00                	mov    (%eax),%eax
c01054bb:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01054c0:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01054c3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01054c6:	c1 e8 0c             	shr    $0xc,%eax
c01054c9:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01054cc:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01054d1:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c01054d4:	72 23                	jb     c01054f9 <get_pte+0x11d>
c01054d6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01054d9:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01054dd:	c7 44 24 08 8c a8 10 	movl   $0xc010a88c,0x8(%esp)
c01054e4:	c0 
c01054e5:	c7 44 24 04 9a 01 00 	movl   $0x19a,0x4(%esp)
c01054ec:	00 
c01054ed:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01054f4:	e8 2a b7 ff ff       	call   c0100c23 <__panic>
c01054f9:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01054fc:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105501:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105504:	c1 ea 0c             	shr    $0xc,%edx
c0105507:	81 e2 ff 03 00 00    	and    $0x3ff,%edx
c010550d:	c1 e2 02             	shl    $0x2,%edx
c0105510:	01 d0                	add    %edx,%eax
}
c0105512:	c9                   	leave  
c0105513:	c3                   	ret    

c0105514 <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c0105514:	55                   	push   %ebp
c0105515:	89 e5                	mov    %esp,%ebp
c0105517:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c010551a:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105521:	00 
c0105522:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105525:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105529:	8b 45 08             	mov    0x8(%ebp),%eax
c010552c:	89 04 24             	mov    %eax,(%esp)
c010552f:	e8 a8 fe ff ff       	call   c01053dc <get_pte>
c0105534:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c0105537:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010553b:	74 08                	je     c0105545 <get_page+0x31>
        *ptep_store = ptep;
c010553d:	8b 45 10             	mov    0x10(%ebp),%eax
c0105540:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105543:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c0105545:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105549:	74 1b                	je     c0105566 <get_page+0x52>
c010554b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010554e:	8b 00                	mov    (%eax),%eax
c0105550:	83 e0 01             	and    $0x1,%eax
c0105553:	85 c0                	test   %eax,%eax
c0105555:	74 0f                	je     c0105566 <get_page+0x52>
        return pa2page(*ptep);
c0105557:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010555a:	8b 00                	mov    (%eax),%eax
c010555c:	89 04 24             	mov    %eax,(%esp)
c010555f:	e8 35 f4 ff ff       	call   c0104999 <pa2page>
c0105564:	eb 05                	jmp    c010556b <get_page+0x57>
    }
    return NULL;
c0105566:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010556b:	c9                   	leave  
c010556c:	c3                   	ret    

c010556d <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c010556d:	55                   	push   %ebp
c010556e:	89 e5                	mov    %esp,%ebp
c0105570:	83 ec 28             	sub    $0x28,%esp
                                  //(4) and free this page when page reference reachs 0
                                  //(5) clear second page table entry
                                  //(6) flush tlb
    }
#endif
    if (*ptep & PTE_P) {
c0105573:	8b 45 10             	mov    0x10(%ebp),%eax
c0105576:	8b 00                	mov    (%eax),%eax
c0105578:	83 e0 01             	and    $0x1,%eax
c010557b:	85 c0                	test   %eax,%eax
c010557d:	74 4d                	je     c01055cc <page_remove_pte+0x5f>
        struct Page *page = pte2page(*ptep);
c010557f:	8b 45 10             	mov    0x10(%ebp),%eax
c0105582:	8b 00                	mov    (%eax),%eax
c0105584:	89 04 24             	mov    %eax,(%esp)
c0105587:	e8 a6 f4 ff ff       	call   c0104a32 <pte2page>
c010558c:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (page_ref_dec(page) == 0) {
c010558f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105592:	89 04 24             	mov    %eax,(%esp)
c0105595:	e8 04 f5 ff ff       	call   c0104a9e <page_ref_dec>
c010559a:	85 c0                	test   %eax,%eax
c010559c:	75 13                	jne    c01055b1 <page_remove_pte+0x44>
            free_page(page);
c010559e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01055a5:	00 
c01055a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01055a9:	89 04 24             	mov    %eax,(%esp)
c01055ac:	e8 2f f7 ff ff       	call   c0104ce0 <free_pages>
        }
        *ptep = 0;
c01055b1:	8b 45 10             	mov    0x10(%ebp),%eax
c01055b4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir, la);
c01055ba:	8b 45 0c             	mov    0xc(%ebp),%eax
c01055bd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01055c1:	8b 45 08             	mov    0x8(%ebp),%eax
c01055c4:	89 04 24             	mov    %eax,(%esp)
c01055c7:	e8 ff 00 00 00       	call   c01056cb <tlb_invalidate>
    }
}
c01055cc:	c9                   	leave  
c01055cd:	c3                   	ret    

c01055ce <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c01055ce:	55                   	push   %ebp
c01055cf:	89 e5                	mov    %esp,%ebp
c01055d1:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c01055d4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01055db:	00 
c01055dc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01055df:	89 44 24 04          	mov    %eax,0x4(%esp)
c01055e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01055e6:	89 04 24             	mov    %eax,(%esp)
c01055e9:	e8 ee fd ff ff       	call   c01053dc <get_pte>
c01055ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c01055f1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01055f5:	74 19                	je     c0105610 <page_remove+0x42>
        page_remove_pte(pgdir, la, ptep);
c01055f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01055fa:	89 44 24 08          	mov    %eax,0x8(%esp)
c01055fe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105601:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105605:	8b 45 08             	mov    0x8(%ebp),%eax
c0105608:	89 04 24             	mov    %eax,(%esp)
c010560b:	e8 5d ff ff ff       	call   c010556d <page_remove_pte>
    }
}
c0105610:	c9                   	leave  
c0105611:	c3                   	ret    

c0105612 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c0105612:	55                   	push   %ebp
c0105613:	89 e5                	mov    %esp,%ebp
c0105615:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c0105618:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c010561f:	00 
c0105620:	8b 45 10             	mov    0x10(%ebp),%eax
c0105623:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105627:	8b 45 08             	mov    0x8(%ebp),%eax
c010562a:	89 04 24             	mov    %eax,(%esp)
c010562d:	e8 aa fd ff ff       	call   c01053dc <get_pte>
c0105632:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep == NULL) {
c0105635:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105639:	75 0a                	jne    c0105645 <page_insert+0x33>
        return -E_NO_MEM;
c010563b:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0105640:	e9 84 00 00 00       	jmp    c01056c9 <page_insert+0xb7>
    }
    page_ref_inc(page);
c0105645:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105648:	89 04 24             	mov    %eax,(%esp)
c010564b:	e8 37 f4 ff ff       	call   c0104a87 <page_ref_inc>
    if (*ptep & PTE_P) {
c0105650:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105653:	8b 00                	mov    (%eax),%eax
c0105655:	83 e0 01             	and    $0x1,%eax
c0105658:	85 c0                	test   %eax,%eax
c010565a:	74 3e                	je     c010569a <page_insert+0x88>
        struct Page *p = pte2page(*ptep);
c010565c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010565f:	8b 00                	mov    (%eax),%eax
c0105661:	89 04 24             	mov    %eax,(%esp)
c0105664:	e8 c9 f3 ff ff       	call   c0104a32 <pte2page>
c0105669:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (p == page) {
c010566c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010566f:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0105672:	75 0d                	jne    c0105681 <page_insert+0x6f>
            page_ref_dec(page);
c0105674:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105677:	89 04 24             	mov    %eax,(%esp)
c010567a:	e8 1f f4 ff ff       	call   c0104a9e <page_ref_dec>
c010567f:	eb 19                	jmp    c010569a <page_insert+0x88>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c0105681:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105684:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105688:	8b 45 10             	mov    0x10(%ebp),%eax
c010568b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010568f:	8b 45 08             	mov    0x8(%ebp),%eax
c0105692:	89 04 24             	mov    %eax,(%esp)
c0105695:	e8 d3 fe ff ff       	call   c010556d <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c010569a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010569d:	89 04 24             	mov    %eax,(%esp)
c01056a0:	e8 de f2 ff ff       	call   c0104983 <page2pa>
c01056a5:	0b 45 14             	or     0x14(%ebp),%eax
c01056a8:	83 c8 01             	or     $0x1,%eax
c01056ab:	89 c2                	mov    %eax,%edx
c01056ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01056b0:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c01056b2:	8b 45 10             	mov    0x10(%ebp),%eax
c01056b5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01056b9:	8b 45 08             	mov    0x8(%ebp),%eax
c01056bc:	89 04 24             	mov    %eax,(%esp)
c01056bf:	e8 07 00 00 00       	call   c01056cb <tlb_invalidate>
    return 0;
c01056c4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01056c9:	c9                   	leave  
c01056ca:	c3                   	ret    

c01056cb <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c01056cb:	55                   	push   %ebp
c01056cc:	89 e5                	mov    %esp,%ebp
c01056ce:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3) :: "memory");
c01056d1:	0f 20 d8             	mov    %cr3,%eax
c01056d4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c01056d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
    if (rcr3() == PADDR(pgdir)) {
c01056da:	89 c2                	mov    %eax,%edx
c01056dc:	8b 45 08             	mov    0x8(%ebp),%eax
c01056df:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01056e2:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01056e9:	77 23                	ja     c010570e <tlb_invalidate+0x43>
c01056eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01056ee:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01056f2:	c7 44 24 08 30 a9 10 	movl   $0xc010a930,0x8(%esp)
c01056f9:	c0 
c01056fa:	c7 44 24 04 fc 01 00 	movl   $0x1fc,0x4(%esp)
c0105701:	00 
c0105702:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105709:	e8 15 b5 ff ff       	call   c0100c23 <__panic>
c010570e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105711:	05 00 00 00 40       	add    $0x40000000,%eax
c0105716:	39 c2                	cmp    %eax,%edx
c0105718:	75 0c                	jne    c0105726 <tlb_invalidate+0x5b>
        invlpg((void *)la);
c010571a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010571d:	89 45 ec             	mov    %eax,-0x14(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c0105720:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105723:	0f 01 38             	invlpg (%eax)
    }
}
c0105726:	c9                   	leave  
c0105727:	c3                   	ret    

c0105728 <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c0105728:	55                   	push   %ebp
c0105729:	89 e5                	mov    %esp,%ebp
c010572b:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c010572e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105735:	e8 3b f5 ff ff       	call   c0104c75 <alloc_pages>
c010573a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c010573d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105741:	0f 84 a7 00 00 00    	je     c01057ee <pgdir_alloc_page+0xc6>
        if (page_insert(pgdir, page, la, perm) != 0) {
c0105747:	8b 45 10             	mov    0x10(%ebp),%eax
c010574a:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010574e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105751:	89 44 24 08          	mov    %eax,0x8(%esp)
c0105755:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105758:	89 44 24 04          	mov    %eax,0x4(%esp)
c010575c:	8b 45 08             	mov    0x8(%ebp),%eax
c010575f:	89 04 24             	mov    %eax,(%esp)
c0105762:	e8 ab fe ff ff       	call   c0105612 <page_insert>
c0105767:	85 c0                	test   %eax,%eax
c0105769:	74 1a                	je     c0105785 <pgdir_alloc_page+0x5d>
            free_page(page);
c010576b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105772:	00 
c0105773:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105776:	89 04 24             	mov    %eax,(%esp)
c0105779:	e8 62 f5 ff ff       	call   c0104ce0 <free_pages>
            return NULL;
c010577e:	b8 00 00 00 00       	mov    $0x0,%eax
c0105783:	eb 6c                	jmp    c01057f1 <pgdir_alloc_page+0xc9>
        }
        if (swap_init_ok){
c0105785:	a1 cc 5a 12 c0       	mov    0xc0125acc,%eax
c010578a:	85 c0                	test   %eax,%eax
c010578c:	74 60                	je     c01057ee <pgdir_alloc_page+0xc6>
            swap_map_swappable(check_mm_struct, la, page, 0);
c010578e:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c0105793:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010579a:	00 
c010579b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010579e:	89 54 24 08          	mov    %edx,0x8(%esp)
c01057a2:	8b 55 0c             	mov    0xc(%ebp),%edx
c01057a5:	89 54 24 04          	mov    %edx,0x4(%esp)
c01057a9:	89 04 24             	mov    %eax,(%esp)
c01057ac:	e8 3e 0e 00 00       	call   c01065ef <swap_map_swappable>
            page->pra_vaddr=la;
c01057b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01057b4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01057b7:	89 50 1c             	mov    %edx,0x1c(%eax)
            assert(page_ref(page) == 1);
c01057ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01057bd:	89 04 24             	mov    %eax,(%esp)
c01057c0:	e8 ab f2 ff ff       	call   c0104a70 <page_ref>
c01057c5:	83 f8 01             	cmp    $0x1,%eax
c01057c8:	74 24                	je     c01057ee <pgdir_alloc_page+0xc6>
c01057ca:	c7 44 24 0c b4 a9 10 	movl   $0xc010a9b4,0xc(%esp)
c01057d1:	c0 
c01057d2:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c01057d9:	c0 
c01057da:	c7 44 24 04 0f 02 00 	movl   $0x20f,0x4(%esp)
c01057e1:	00 
c01057e2:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01057e9:	e8 35 b4 ff ff       	call   c0100c23 <__panic>
            //cprintf("get No. %d  page: pra_vaddr %x, pra_link.prev %x, pra_link_next %x in pgdir_alloc_page\n", (page-pages), page->pra_vaddr,page->pra_page_link.prev, page->pra_page_link.next);
        }

    }

    return page;
c01057ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01057f1:	c9                   	leave  
c01057f2:	c3                   	ret    

c01057f3 <check_alloc_page>:

static void
check_alloc_page(void) {
c01057f3:	55                   	push   %ebp
c01057f4:	89 e5                	mov    %esp,%ebp
c01057f6:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c01057f9:	a1 24 7b 12 c0       	mov    0xc0127b24,%eax
c01057fe:	8b 40 18             	mov    0x18(%eax),%eax
c0105801:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c0105803:	c7 04 24 c8 a9 10 c0 	movl   $0xc010a9c8,(%esp)
c010580a:	e8 44 ab ff ff       	call   c0100353 <cprintf>
}
c010580f:	c9                   	leave  
c0105810:	c3                   	ret    

c0105811 <check_pgdir>:

static void
check_pgdir(void) {
c0105811:	55                   	push   %ebp
c0105812:	89 e5                	mov    %esp,%ebp
c0105814:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c0105817:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c010581c:	3d 00 80 03 00       	cmp    $0x38000,%eax
c0105821:	76 24                	jbe    c0105847 <check_pgdir+0x36>
c0105823:	c7 44 24 0c e7 a9 10 	movl   $0xc010a9e7,0xc(%esp)
c010582a:	c0 
c010582b:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105832:	c0 
c0105833:	c7 44 24 04 20 02 00 	movl   $0x220,0x4(%esp)
c010583a:	00 
c010583b:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105842:	e8 dc b3 ff ff       	call   c0100c23 <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c0105847:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c010584c:	85 c0                	test   %eax,%eax
c010584e:	74 0e                	je     c010585e <check_pgdir+0x4d>
c0105850:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105855:	25 ff 0f 00 00       	and    $0xfff,%eax
c010585a:	85 c0                	test   %eax,%eax
c010585c:	74 24                	je     c0105882 <check_pgdir+0x71>
c010585e:	c7 44 24 0c 04 aa 10 	movl   $0xc010aa04,0xc(%esp)
c0105865:	c0 
c0105866:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c010586d:	c0 
c010586e:	c7 44 24 04 21 02 00 	movl   $0x221,0x4(%esp)
c0105875:	00 
c0105876:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010587d:	e8 a1 b3 ff ff       	call   c0100c23 <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c0105882:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105887:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010588e:	00 
c010588f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105896:	00 
c0105897:	89 04 24             	mov    %eax,(%esp)
c010589a:	e8 75 fc ff ff       	call   c0105514 <get_page>
c010589f:	85 c0                	test   %eax,%eax
c01058a1:	74 24                	je     c01058c7 <check_pgdir+0xb6>
c01058a3:	c7 44 24 0c 3c aa 10 	movl   $0xc010aa3c,0xc(%esp)
c01058aa:	c0 
c01058ab:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c01058b2:	c0 
c01058b3:	c7 44 24 04 22 02 00 	movl   $0x222,0x4(%esp)
c01058ba:	00 
c01058bb:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01058c2:	e8 5c b3 ff ff       	call   c0100c23 <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c01058c7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01058ce:	e8 a2 f3 ff ff       	call   c0104c75 <alloc_pages>
c01058d3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c01058d6:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01058db:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01058e2:	00 
c01058e3:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01058ea:	00 
c01058eb:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01058ee:	89 54 24 04          	mov    %edx,0x4(%esp)
c01058f2:	89 04 24             	mov    %eax,(%esp)
c01058f5:	e8 18 fd ff ff       	call   c0105612 <page_insert>
c01058fa:	85 c0                	test   %eax,%eax
c01058fc:	74 24                	je     c0105922 <check_pgdir+0x111>
c01058fe:	c7 44 24 0c 64 aa 10 	movl   $0xc010aa64,0xc(%esp)
c0105905:	c0 
c0105906:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c010590d:	c0 
c010590e:	c7 44 24 04 26 02 00 	movl   $0x226,0x4(%esp)
c0105915:	00 
c0105916:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010591d:	e8 01 b3 ff ff       	call   c0100c23 <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c0105922:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105927:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010592e:	00 
c010592f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105936:	00 
c0105937:	89 04 24             	mov    %eax,(%esp)
c010593a:	e8 9d fa ff ff       	call   c01053dc <get_pte>
c010593f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105942:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105946:	75 24                	jne    c010596c <check_pgdir+0x15b>
c0105948:	c7 44 24 0c 90 aa 10 	movl   $0xc010aa90,0xc(%esp)
c010594f:	c0 
c0105950:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105957:	c0 
c0105958:	c7 44 24 04 29 02 00 	movl   $0x229,0x4(%esp)
c010595f:	00 
c0105960:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105967:	e8 b7 b2 ff ff       	call   c0100c23 <__panic>
    assert(pa2page(*ptep) == p1);
c010596c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010596f:	8b 00                	mov    (%eax),%eax
c0105971:	89 04 24             	mov    %eax,(%esp)
c0105974:	e8 20 f0 ff ff       	call   c0104999 <pa2page>
c0105979:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010597c:	74 24                	je     c01059a2 <check_pgdir+0x191>
c010597e:	c7 44 24 0c bd aa 10 	movl   $0xc010aabd,0xc(%esp)
c0105985:	c0 
c0105986:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c010598d:	c0 
c010598e:	c7 44 24 04 2a 02 00 	movl   $0x22a,0x4(%esp)
c0105995:	00 
c0105996:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010599d:	e8 81 b2 ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p1) == 1);
c01059a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059a5:	89 04 24             	mov    %eax,(%esp)
c01059a8:	e8 c3 f0 ff ff       	call   c0104a70 <page_ref>
c01059ad:	83 f8 01             	cmp    $0x1,%eax
c01059b0:	74 24                	je     c01059d6 <check_pgdir+0x1c5>
c01059b2:	c7 44 24 0c d2 aa 10 	movl   $0xc010aad2,0xc(%esp)
c01059b9:	c0 
c01059ba:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c01059c1:	c0 
c01059c2:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c01059c9:	00 
c01059ca:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01059d1:	e8 4d b2 ff ff       	call   c0100c23 <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c01059d6:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01059db:	8b 00                	mov    (%eax),%eax
c01059dd:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01059e2:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01059e5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01059e8:	c1 e8 0c             	shr    $0xc,%eax
c01059eb:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01059ee:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01059f3:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c01059f6:	72 23                	jb     c0105a1b <check_pgdir+0x20a>
c01059f8:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01059fb:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01059ff:	c7 44 24 08 8c a8 10 	movl   $0xc010a88c,0x8(%esp)
c0105a06:	c0 
c0105a07:	c7 44 24 04 2d 02 00 	movl   $0x22d,0x4(%esp)
c0105a0e:	00 
c0105a0f:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105a16:	e8 08 b2 ff ff       	call   c0100c23 <__panic>
c0105a1b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105a1e:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105a23:	83 c0 04             	add    $0x4,%eax
c0105a26:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c0105a29:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105a2e:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105a35:	00 
c0105a36:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0105a3d:	00 
c0105a3e:	89 04 24             	mov    %eax,(%esp)
c0105a41:	e8 96 f9 ff ff       	call   c01053dc <get_pte>
c0105a46:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0105a49:	74 24                	je     c0105a6f <check_pgdir+0x25e>
c0105a4b:	c7 44 24 0c e4 aa 10 	movl   $0xc010aae4,0xc(%esp)
c0105a52:	c0 
c0105a53:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105a5a:	c0 
c0105a5b:	c7 44 24 04 2e 02 00 	movl   $0x22e,0x4(%esp)
c0105a62:	00 
c0105a63:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105a6a:	e8 b4 b1 ff ff       	call   c0100c23 <__panic>

    p2 = alloc_page();
c0105a6f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105a76:	e8 fa f1 ff ff       	call   c0104c75 <alloc_pages>
c0105a7b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c0105a7e:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105a83:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c0105a8a:	00 
c0105a8b:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0105a92:	00 
c0105a93:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0105a96:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105a9a:	89 04 24             	mov    %eax,(%esp)
c0105a9d:	e8 70 fb ff ff       	call   c0105612 <page_insert>
c0105aa2:	85 c0                	test   %eax,%eax
c0105aa4:	74 24                	je     c0105aca <check_pgdir+0x2b9>
c0105aa6:	c7 44 24 0c 0c ab 10 	movl   $0xc010ab0c,0xc(%esp)
c0105aad:	c0 
c0105aae:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105ab5:	c0 
c0105ab6:	c7 44 24 04 31 02 00 	movl   $0x231,0x4(%esp)
c0105abd:	00 
c0105abe:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105ac5:	e8 59 b1 ff ff       	call   c0100c23 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0105aca:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105acf:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105ad6:	00 
c0105ad7:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0105ade:	00 
c0105adf:	89 04 24             	mov    %eax,(%esp)
c0105ae2:	e8 f5 f8 ff ff       	call   c01053dc <get_pte>
c0105ae7:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105aea:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105aee:	75 24                	jne    c0105b14 <check_pgdir+0x303>
c0105af0:	c7 44 24 0c 44 ab 10 	movl   $0xc010ab44,0xc(%esp)
c0105af7:	c0 
c0105af8:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105aff:	c0 
c0105b00:	c7 44 24 04 32 02 00 	movl   $0x232,0x4(%esp)
c0105b07:	00 
c0105b08:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105b0f:	e8 0f b1 ff ff       	call   c0100c23 <__panic>
    assert(*ptep & PTE_U);
c0105b14:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b17:	8b 00                	mov    (%eax),%eax
c0105b19:	83 e0 04             	and    $0x4,%eax
c0105b1c:	85 c0                	test   %eax,%eax
c0105b1e:	75 24                	jne    c0105b44 <check_pgdir+0x333>
c0105b20:	c7 44 24 0c 74 ab 10 	movl   $0xc010ab74,0xc(%esp)
c0105b27:	c0 
c0105b28:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105b2f:	c0 
c0105b30:	c7 44 24 04 33 02 00 	movl   $0x233,0x4(%esp)
c0105b37:	00 
c0105b38:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105b3f:	e8 df b0 ff ff       	call   c0100c23 <__panic>
    assert(*ptep & PTE_W);
c0105b44:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b47:	8b 00                	mov    (%eax),%eax
c0105b49:	83 e0 02             	and    $0x2,%eax
c0105b4c:	85 c0                	test   %eax,%eax
c0105b4e:	75 24                	jne    c0105b74 <check_pgdir+0x363>
c0105b50:	c7 44 24 0c 82 ab 10 	movl   $0xc010ab82,0xc(%esp)
c0105b57:	c0 
c0105b58:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105b5f:	c0 
c0105b60:	c7 44 24 04 34 02 00 	movl   $0x234,0x4(%esp)
c0105b67:	00 
c0105b68:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105b6f:	e8 af b0 ff ff       	call   c0100c23 <__panic>
    assert(boot_pgdir[0] & PTE_U);
c0105b74:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105b79:	8b 00                	mov    (%eax),%eax
c0105b7b:	83 e0 04             	and    $0x4,%eax
c0105b7e:	85 c0                	test   %eax,%eax
c0105b80:	75 24                	jne    c0105ba6 <check_pgdir+0x395>
c0105b82:	c7 44 24 0c 90 ab 10 	movl   $0xc010ab90,0xc(%esp)
c0105b89:	c0 
c0105b8a:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105b91:	c0 
c0105b92:	c7 44 24 04 35 02 00 	movl   $0x235,0x4(%esp)
c0105b99:	00 
c0105b9a:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105ba1:	e8 7d b0 ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p2) == 1);
c0105ba6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105ba9:	89 04 24             	mov    %eax,(%esp)
c0105bac:	e8 bf ee ff ff       	call   c0104a70 <page_ref>
c0105bb1:	83 f8 01             	cmp    $0x1,%eax
c0105bb4:	74 24                	je     c0105bda <check_pgdir+0x3c9>
c0105bb6:	c7 44 24 0c a6 ab 10 	movl   $0xc010aba6,0xc(%esp)
c0105bbd:	c0 
c0105bbe:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105bc5:	c0 
c0105bc6:	c7 44 24 04 36 02 00 	movl   $0x236,0x4(%esp)
c0105bcd:	00 
c0105bce:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105bd5:	e8 49 b0 ff ff       	call   c0100c23 <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c0105bda:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105bdf:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0105be6:	00 
c0105be7:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0105bee:	00 
c0105bef:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105bf2:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105bf6:	89 04 24             	mov    %eax,(%esp)
c0105bf9:	e8 14 fa ff ff       	call   c0105612 <page_insert>
c0105bfe:	85 c0                	test   %eax,%eax
c0105c00:	74 24                	je     c0105c26 <check_pgdir+0x415>
c0105c02:	c7 44 24 0c b8 ab 10 	movl   $0xc010abb8,0xc(%esp)
c0105c09:	c0 
c0105c0a:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105c11:	c0 
c0105c12:	c7 44 24 04 38 02 00 	movl   $0x238,0x4(%esp)
c0105c19:	00 
c0105c1a:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105c21:	e8 fd af ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p1) == 2);
c0105c26:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c29:	89 04 24             	mov    %eax,(%esp)
c0105c2c:	e8 3f ee ff ff       	call   c0104a70 <page_ref>
c0105c31:	83 f8 02             	cmp    $0x2,%eax
c0105c34:	74 24                	je     c0105c5a <check_pgdir+0x449>
c0105c36:	c7 44 24 0c e4 ab 10 	movl   $0xc010abe4,0xc(%esp)
c0105c3d:	c0 
c0105c3e:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105c45:	c0 
c0105c46:	c7 44 24 04 39 02 00 	movl   $0x239,0x4(%esp)
c0105c4d:	00 
c0105c4e:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105c55:	e8 c9 af ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p2) == 0);
c0105c5a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105c5d:	89 04 24             	mov    %eax,(%esp)
c0105c60:	e8 0b ee ff ff       	call   c0104a70 <page_ref>
c0105c65:	85 c0                	test   %eax,%eax
c0105c67:	74 24                	je     c0105c8d <check_pgdir+0x47c>
c0105c69:	c7 44 24 0c f6 ab 10 	movl   $0xc010abf6,0xc(%esp)
c0105c70:	c0 
c0105c71:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105c78:	c0 
c0105c79:	c7 44 24 04 3a 02 00 	movl   $0x23a,0x4(%esp)
c0105c80:	00 
c0105c81:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105c88:	e8 96 af ff ff       	call   c0100c23 <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0105c8d:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105c92:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105c99:	00 
c0105c9a:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0105ca1:	00 
c0105ca2:	89 04 24             	mov    %eax,(%esp)
c0105ca5:	e8 32 f7 ff ff       	call   c01053dc <get_pte>
c0105caa:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105cad:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105cb1:	75 24                	jne    c0105cd7 <check_pgdir+0x4c6>
c0105cb3:	c7 44 24 0c 44 ab 10 	movl   $0xc010ab44,0xc(%esp)
c0105cba:	c0 
c0105cbb:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105cc2:	c0 
c0105cc3:	c7 44 24 04 3b 02 00 	movl   $0x23b,0x4(%esp)
c0105cca:	00 
c0105ccb:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105cd2:	e8 4c af ff ff       	call   c0100c23 <__panic>
    assert(pa2page(*ptep) == p1);
c0105cd7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105cda:	8b 00                	mov    (%eax),%eax
c0105cdc:	89 04 24             	mov    %eax,(%esp)
c0105cdf:	e8 b5 ec ff ff       	call   c0104999 <pa2page>
c0105ce4:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0105ce7:	74 24                	je     c0105d0d <check_pgdir+0x4fc>
c0105ce9:	c7 44 24 0c bd aa 10 	movl   $0xc010aabd,0xc(%esp)
c0105cf0:	c0 
c0105cf1:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105cf8:	c0 
c0105cf9:	c7 44 24 04 3c 02 00 	movl   $0x23c,0x4(%esp)
c0105d00:	00 
c0105d01:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105d08:	e8 16 af ff ff       	call   c0100c23 <__panic>
    assert((*ptep & PTE_U) == 0);
c0105d0d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d10:	8b 00                	mov    (%eax),%eax
c0105d12:	83 e0 04             	and    $0x4,%eax
c0105d15:	85 c0                	test   %eax,%eax
c0105d17:	74 24                	je     c0105d3d <check_pgdir+0x52c>
c0105d19:	c7 44 24 0c 08 ac 10 	movl   $0xc010ac08,0xc(%esp)
c0105d20:	c0 
c0105d21:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105d28:	c0 
c0105d29:	c7 44 24 04 3d 02 00 	movl   $0x23d,0x4(%esp)
c0105d30:	00 
c0105d31:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105d38:	e8 e6 ae ff ff       	call   c0100c23 <__panic>

    page_remove(boot_pgdir, 0x0);
c0105d3d:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105d42:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105d49:	00 
c0105d4a:	89 04 24             	mov    %eax,(%esp)
c0105d4d:	e8 7c f8 ff ff       	call   c01055ce <page_remove>
    assert(page_ref(p1) == 1);
c0105d52:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105d55:	89 04 24             	mov    %eax,(%esp)
c0105d58:	e8 13 ed ff ff       	call   c0104a70 <page_ref>
c0105d5d:	83 f8 01             	cmp    $0x1,%eax
c0105d60:	74 24                	je     c0105d86 <check_pgdir+0x575>
c0105d62:	c7 44 24 0c d2 aa 10 	movl   $0xc010aad2,0xc(%esp)
c0105d69:	c0 
c0105d6a:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105d71:	c0 
c0105d72:	c7 44 24 04 40 02 00 	movl   $0x240,0x4(%esp)
c0105d79:	00 
c0105d7a:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105d81:	e8 9d ae ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p2) == 0);
c0105d86:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105d89:	89 04 24             	mov    %eax,(%esp)
c0105d8c:	e8 df ec ff ff       	call   c0104a70 <page_ref>
c0105d91:	85 c0                	test   %eax,%eax
c0105d93:	74 24                	je     c0105db9 <check_pgdir+0x5a8>
c0105d95:	c7 44 24 0c f6 ab 10 	movl   $0xc010abf6,0xc(%esp)
c0105d9c:	c0 
c0105d9d:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105da4:	c0 
c0105da5:	c7 44 24 04 41 02 00 	movl   $0x241,0x4(%esp)
c0105dac:	00 
c0105dad:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105db4:	e8 6a ae ff ff       	call   c0100c23 <__panic>

    page_remove(boot_pgdir, PGSIZE);
c0105db9:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105dbe:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0105dc5:	00 
c0105dc6:	89 04 24             	mov    %eax,(%esp)
c0105dc9:	e8 00 f8 ff ff       	call   c01055ce <page_remove>
    assert(page_ref(p1) == 0);
c0105dce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dd1:	89 04 24             	mov    %eax,(%esp)
c0105dd4:	e8 97 ec ff ff       	call   c0104a70 <page_ref>
c0105dd9:	85 c0                	test   %eax,%eax
c0105ddb:	74 24                	je     c0105e01 <check_pgdir+0x5f0>
c0105ddd:	c7 44 24 0c 1d ac 10 	movl   $0xc010ac1d,0xc(%esp)
c0105de4:	c0 
c0105de5:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105dec:	c0 
c0105ded:	c7 44 24 04 44 02 00 	movl   $0x244,0x4(%esp)
c0105df4:	00 
c0105df5:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105dfc:	e8 22 ae ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p2) == 0);
c0105e01:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105e04:	89 04 24             	mov    %eax,(%esp)
c0105e07:	e8 64 ec ff ff       	call   c0104a70 <page_ref>
c0105e0c:	85 c0                	test   %eax,%eax
c0105e0e:	74 24                	je     c0105e34 <check_pgdir+0x623>
c0105e10:	c7 44 24 0c f6 ab 10 	movl   $0xc010abf6,0xc(%esp)
c0105e17:	c0 
c0105e18:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105e1f:	c0 
c0105e20:	c7 44 24 04 45 02 00 	movl   $0x245,0x4(%esp)
c0105e27:	00 
c0105e28:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105e2f:	e8 ef ad ff ff       	call   c0100c23 <__panic>

    assert(page_ref(pa2page(boot_pgdir[0])) == 1);
c0105e34:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105e39:	8b 00                	mov    (%eax),%eax
c0105e3b:	89 04 24             	mov    %eax,(%esp)
c0105e3e:	e8 56 eb ff ff       	call   c0104999 <pa2page>
c0105e43:	89 04 24             	mov    %eax,(%esp)
c0105e46:	e8 25 ec ff ff       	call   c0104a70 <page_ref>
c0105e4b:	83 f8 01             	cmp    $0x1,%eax
c0105e4e:	74 24                	je     c0105e74 <check_pgdir+0x663>
c0105e50:	c7 44 24 0c 30 ac 10 	movl   $0xc010ac30,0xc(%esp)
c0105e57:	c0 
c0105e58:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105e5f:	c0 
c0105e60:	c7 44 24 04 47 02 00 	movl   $0x247,0x4(%esp)
c0105e67:	00 
c0105e68:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105e6f:	e8 af ad ff ff       	call   c0100c23 <__panic>
    free_page(pa2page(boot_pgdir[0]));
c0105e74:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105e79:	8b 00                	mov    (%eax),%eax
c0105e7b:	89 04 24             	mov    %eax,(%esp)
c0105e7e:	e8 16 eb ff ff       	call   c0104999 <pa2page>
c0105e83:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0105e8a:	00 
c0105e8b:	89 04 24             	mov    %eax,(%esp)
c0105e8e:	e8 4d ee ff ff       	call   c0104ce0 <free_pages>
    boot_pgdir[0] = 0;
c0105e93:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105e98:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c0105e9e:	c7 04 24 56 ac 10 c0 	movl   $0xc010ac56,(%esp)
c0105ea5:	e8 a9 a4 ff ff       	call   c0100353 <cprintf>
}
c0105eaa:	c9                   	leave  
c0105eab:	c3                   	ret    

c0105eac <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c0105eac:	55                   	push   %ebp
c0105ead:	89 e5                	mov    %esp,%ebp
c0105eaf:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0105eb2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0105eb9:	e9 ca 00 00 00       	jmp    c0105f88 <check_boot_pgdir+0xdc>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c0105ebe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ec1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105ec4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ec7:	c1 e8 0c             	shr    $0xc,%eax
c0105eca:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0105ecd:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0105ed2:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c0105ed5:	72 23                	jb     c0105efa <check_boot_pgdir+0x4e>
c0105ed7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105eda:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0105ede:	c7 44 24 08 8c a8 10 	movl   $0xc010a88c,0x8(%esp)
c0105ee5:	c0 
c0105ee6:	c7 44 24 04 53 02 00 	movl   $0x253,0x4(%esp)
c0105eed:	00 
c0105eee:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105ef5:	e8 29 ad ff ff       	call   c0100c23 <__panic>
c0105efa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105efd:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0105f02:	89 c2                	mov    %eax,%edx
c0105f04:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105f09:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105f10:	00 
c0105f11:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105f15:	89 04 24             	mov    %eax,(%esp)
c0105f18:	e8 bf f4 ff ff       	call   c01053dc <get_pte>
c0105f1d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0105f20:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0105f24:	75 24                	jne    c0105f4a <check_boot_pgdir+0x9e>
c0105f26:	c7 44 24 0c 70 ac 10 	movl   $0xc010ac70,0xc(%esp)
c0105f2d:	c0 
c0105f2e:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105f35:	c0 
c0105f36:	c7 44 24 04 53 02 00 	movl   $0x253,0x4(%esp)
c0105f3d:	00 
c0105f3e:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105f45:	e8 d9 ac ff ff       	call   c0100c23 <__panic>
        assert(PTE_ADDR(*ptep) == i);
c0105f4a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105f4d:	8b 00                	mov    (%eax),%eax
c0105f4f:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105f54:	89 c2                	mov    %eax,%edx
c0105f56:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105f59:	39 c2                	cmp    %eax,%edx
c0105f5b:	74 24                	je     c0105f81 <check_boot_pgdir+0xd5>
c0105f5d:	c7 44 24 0c ad ac 10 	movl   $0xc010acad,0xc(%esp)
c0105f64:	c0 
c0105f65:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105f6c:	c0 
c0105f6d:	c7 44 24 04 54 02 00 	movl   $0x254,0x4(%esp)
c0105f74:	00 
c0105f75:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105f7c:	e8 a2 ac ff ff       	call   c0100c23 <__panic>

static void
check_boot_pgdir(void) {
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0105f81:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
c0105f88:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105f8b:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0105f90:	39 c2                	cmp    %eax,%edx
c0105f92:	0f 82 26 ff ff ff    	jb     c0105ebe <check_boot_pgdir+0x12>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
        assert(PTE_ADDR(*ptep) == i);
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c0105f98:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105f9d:	05 ac 0f 00 00       	add    $0xfac,%eax
c0105fa2:	8b 00                	mov    (%eax),%eax
c0105fa4:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0105fa9:	89 c2                	mov    %eax,%edx
c0105fab:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0105fb0:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0105fb3:	81 7d e4 ff ff ff bf 	cmpl   $0xbfffffff,-0x1c(%ebp)
c0105fba:	77 23                	ja     c0105fdf <check_boot_pgdir+0x133>
c0105fbc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105fbf:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0105fc3:	c7 44 24 08 30 a9 10 	movl   $0xc010a930,0x8(%esp)
c0105fca:	c0 
c0105fcb:	c7 44 24 04 57 02 00 	movl   $0x257,0x4(%esp)
c0105fd2:	00 
c0105fd3:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0105fda:	e8 44 ac ff ff       	call   c0100c23 <__panic>
c0105fdf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105fe2:	05 00 00 00 40       	add    $0x40000000,%eax
c0105fe7:	39 c2                	cmp    %eax,%edx
c0105fe9:	74 24                	je     c010600f <check_boot_pgdir+0x163>
c0105feb:	c7 44 24 0c c4 ac 10 	movl   $0xc010acc4,0xc(%esp)
c0105ff2:	c0 
c0105ff3:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0105ffa:	c0 
c0105ffb:	c7 44 24 04 57 02 00 	movl   $0x257,0x4(%esp)
c0106002:	00 
c0106003:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010600a:	e8 14 ac ff ff       	call   c0100c23 <__panic>

    assert(boot_pgdir[0] == 0);
c010600f:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0106014:	8b 00                	mov    (%eax),%eax
c0106016:	85 c0                	test   %eax,%eax
c0106018:	74 24                	je     c010603e <check_boot_pgdir+0x192>
c010601a:	c7 44 24 0c f8 ac 10 	movl   $0xc010acf8,0xc(%esp)
c0106021:	c0 
c0106022:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0106029:	c0 
c010602a:	c7 44 24 04 59 02 00 	movl   $0x259,0x4(%esp)
c0106031:	00 
c0106032:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0106039:	e8 e5 ab ff ff       	call   c0100c23 <__panic>

    struct Page *p;
    p = alloc_page();
c010603e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106045:	e8 2b ec ff ff       	call   c0104c75 <alloc_pages>
c010604a:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c010604d:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0106052:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0106059:	00 
c010605a:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c0106061:	00 
c0106062:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106065:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106069:	89 04 24             	mov    %eax,(%esp)
c010606c:	e8 a1 f5 ff ff       	call   c0105612 <page_insert>
c0106071:	85 c0                	test   %eax,%eax
c0106073:	74 24                	je     c0106099 <check_boot_pgdir+0x1ed>
c0106075:	c7 44 24 0c 0c ad 10 	movl   $0xc010ad0c,0xc(%esp)
c010607c:	c0 
c010607d:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0106084:	c0 
c0106085:	c7 44 24 04 5d 02 00 	movl   $0x25d,0x4(%esp)
c010608c:	00 
c010608d:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0106094:	e8 8a ab ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p) == 1);
c0106099:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010609c:	89 04 24             	mov    %eax,(%esp)
c010609f:	e8 cc e9 ff ff       	call   c0104a70 <page_ref>
c01060a4:	83 f8 01             	cmp    $0x1,%eax
c01060a7:	74 24                	je     c01060cd <check_boot_pgdir+0x221>
c01060a9:	c7 44 24 0c 3a ad 10 	movl   $0xc010ad3a,0xc(%esp)
c01060b0:	c0 
c01060b1:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c01060b8:	c0 
c01060b9:	c7 44 24 04 5e 02 00 	movl   $0x25e,0x4(%esp)
c01060c0:	00 
c01060c1:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01060c8:	e8 56 ab ff ff       	call   c0100c23 <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c01060cd:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c01060d2:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c01060d9:	00 
c01060da:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c01060e1:	00 
c01060e2:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01060e5:	89 54 24 04          	mov    %edx,0x4(%esp)
c01060e9:	89 04 24             	mov    %eax,(%esp)
c01060ec:	e8 21 f5 ff ff       	call   c0105612 <page_insert>
c01060f1:	85 c0                	test   %eax,%eax
c01060f3:	74 24                	je     c0106119 <check_boot_pgdir+0x26d>
c01060f5:	c7 44 24 0c 4c ad 10 	movl   $0xc010ad4c,0xc(%esp)
c01060fc:	c0 
c01060fd:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0106104:	c0 
c0106105:	c7 44 24 04 5f 02 00 	movl   $0x25f,0x4(%esp)
c010610c:	00 
c010610d:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0106114:	e8 0a ab ff ff       	call   c0100c23 <__panic>
    assert(page_ref(p) == 2);
c0106119:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010611c:	89 04 24             	mov    %eax,(%esp)
c010611f:	e8 4c e9 ff ff       	call   c0104a70 <page_ref>
c0106124:	83 f8 02             	cmp    $0x2,%eax
c0106127:	74 24                	je     c010614d <check_boot_pgdir+0x2a1>
c0106129:	c7 44 24 0c 83 ad 10 	movl   $0xc010ad83,0xc(%esp)
c0106130:	c0 
c0106131:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c0106138:	c0 
c0106139:	c7 44 24 04 60 02 00 	movl   $0x260,0x4(%esp)
c0106140:	00 
c0106141:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c0106148:	e8 d6 aa ff ff       	call   c0100c23 <__panic>

    const char *str = "ucore: Hello world!!";
c010614d:	c7 45 dc 94 ad 10 c0 	movl   $0xc010ad94,-0x24(%ebp)
    strcpy((void *)0x100, str);
c0106154:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106157:	89 44 24 04          	mov    %eax,0x4(%esp)
c010615b:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0106162:	e8 cf 35 00 00       	call   c0109736 <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c0106167:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c010616e:	00 
c010616f:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0106176:	e8 34 36 00 00       	call   c01097af <strcmp>
c010617b:	85 c0                	test   %eax,%eax
c010617d:	74 24                	je     c01061a3 <check_boot_pgdir+0x2f7>
c010617f:	c7 44 24 0c ac ad 10 	movl   $0xc010adac,0xc(%esp)
c0106186:	c0 
c0106187:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c010618e:	c0 
c010618f:	c7 44 24 04 64 02 00 	movl   $0x264,0x4(%esp)
c0106196:	00 
c0106197:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c010619e:	e8 80 aa ff ff       	call   c0100c23 <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c01061a3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01061a6:	89 04 24             	mov    %eax,(%esp)
c01061a9:	e8 30 e8 ff ff       	call   c01049de <page2kva>
c01061ae:	05 00 01 00 00       	add    $0x100,%eax
c01061b3:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c01061b6:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c01061bd:	e8 1c 35 00 00       	call   c01096de <strlen>
c01061c2:	85 c0                	test   %eax,%eax
c01061c4:	74 24                	je     c01061ea <check_boot_pgdir+0x33e>
c01061c6:	c7 44 24 0c e4 ad 10 	movl   $0xc010ade4,0xc(%esp)
c01061cd:	c0 
c01061ce:	c7 44 24 08 79 a9 10 	movl   $0xc010a979,0x8(%esp)
c01061d5:	c0 
c01061d6:	c7 44 24 04 67 02 00 	movl   $0x267,0x4(%esp)
c01061dd:	00 
c01061de:	c7 04 24 54 a9 10 c0 	movl   $0xc010a954,(%esp)
c01061e5:	e8 39 aa ff ff       	call   c0100c23 <__panic>

    free_page(p);
c01061ea:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01061f1:	00 
c01061f2:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01061f5:	89 04 24             	mov    %eax,(%esp)
c01061f8:	e8 e3 ea ff ff       	call   c0104ce0 <free_pages>
    free_page(pa2page(PDE_ADDR(boot_pgdir[0])));
c01061fd:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0106202:	8b 00                	mov    (%eax),%eax
c0106204:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106209:	89 04 24             	mov    %eax,(%esp)
c010620c:	e8 88 e7 ff ff       	call   c0104999 <pa2page>
c0106211:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106218:	00 
c0106219:	89 04 24             	mov    %eax,(%esp)
c010621c:	e8 bf ea ff ff       	call   c0104ce0 <free_pages>
    boot_pgdir[0] = 0;
c0106221:	a1 44 5a 12 c0       	mov    0xc0125a44,%eax
c0106226:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c010622c:	c7 04 24 08 ae 10 c0 	movl   $0xc010ae08,(%esp)
c0106233:	e8 1b a1 ff ff       	call   c0100353 <cprintf>
}
c0106238:	c9                   	leave  
c0106239:	c3                   	ret    

c010623a <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c010623a:	55                   	push   %ebp
c010623b:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c010623d:	8b 45 08             	mov    0x8(%ebp),%eax
c0106240:	83 e0 04             	and    $0x4,%eax
c0106243:	85 c0                	test   %eax,%eax
c0106245:	74 07                	je     c010624e <perm2str+0x14>
c0106247:	b8 75 00 00 00       	mov    $0x75,%eax
c010624c:	eb 05                	jmp    c0106253 <perm2str+0x19>
c010624e:	b8 2d 00 00 00       	mov    $0x2d,%eax
c0106253:	a2 c8 5a 12 c0       	mov    %al,0xc0125ac8
    str[1] = 'r';
c0106258:	c6 05 c9 5a 12 c0 72 	movb   $0x72,0xc0125ac9
    str[2] = (perm & PTE_W) ? 'w' : '-';
c010625f:	8b 45 08             	mov    0x8(%ebp),%eax
c0106262:	83 e0 02             	and    $0x2,%eax
c0106265:	85 c0                	test   %eax,%eax
c0106267:	74 07                	je     c0106270 <perm2str+0x36>
c0106269:	b8 77 00 00 00       	mov    $0x77,%eax
c010626e:	eb 05                	jmp    c0106275 <perm2str+0x3b>
c0106270:	b8 2d 00 00 00       	mov    $0x2d,%eax
c0106275:	a2 ca 5a 12 c0       	mov    %al,0xc0125aca
    str[3] = '\0';
c010627a:	c6 05 cb 5a 12 c0 00 	movb   $0x0,0xc0125acb
    return str;
c0106281:	b8 c8 5a 12 c0       	mov    $0xc0125ac8,%eax
}
c0106286:	5d                   	pop    %ebp
c0106287:	c3                   	ret    

c0106288 <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c0106288:	55                   	push   %ebp
c0106289:	89 e5                	mov    %esp,%ebp
c010628b:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c010628e:	8b 45 10             	mov    0x10(%ebp),%eax
c0106291:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0106294:	72 0a                	jb     c01062a0 <get_pgtable_items+0x18>
        return 0;
c0106296:	b8 00 00 00 00       	mov    $0x0,%eax
c010629b:	e9 9c 00 00 00       	jmp    c010633c <get_pgtable_items+0xb4>
    }
    while (start < right && !(table[start] & PTE_P)) {
c01062a0:	eb 04                	jmp    c01062a6 <get_pgtable_items+0x1e>
        start ++;
c01062a2:	83 45 10 01          	addl   $0x1,0x10(%ebp)
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
    if (start >= right) {
        return 0;
    }
    while (start < right && !(table[start] & PTE_P)) {
c01062a6:	8b 45 10             	mov    0x10(%ebp),%eax
c01062a9:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01062ac:	73 18                	jae    c01062c6 <get_pgtable_items+0x3e>
c01062ae:	8b 45 10             	mov    0x10(%ebp),%eax
c01062b1:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01062b8:	8b 45 14             	mov    0x14(%ebp),%eax
c01062bb:	01 d0                	add    %edx,%eax
c01062bd:	8b 00                	mov    (%eax),%eax
c01062bf:	83 e0 01             	and    $0x1,%eax
c01062c2:	85 c0                	test   %eax,%eax
c01062c4:	74 dc                	je     c01062a2 <get_pgtable_items+0x1a>
        start ++;
    }
    if (start < right) {
c01062c6:	8b 45 10             	mov    0x10(%ebp),%eax
c01062c9:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01062cc:	73 69                	jae    c0106337 <get_pgtable_items+0xaf>
        if (left_store != NULL) {
c01062ce:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c01062d2:	74 08                	je     c01062dc <get_pgtable_items+0x54>
            *left_store = start;
c01062d4:	8b 45 18             	mov    0x18(%ebp),%eax
c01062d7:	8b 55 10             	mov    0x10(%ebp),%edx
c01062da:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c01062dc:	8b 45 10             	mov    0x10(%ebp),%eax
c01062df:	8d 50 01             	lea    0x1(%eax),%edx
c01062e2:	89 55 10             	mov    %edx,0x10(%ebp)
c01062e5:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01062ec:	8b 45 14             	mov    0x14(%ebp),%eax
c01062ef:	01 d0                	add    %edx,%eax
c01062f1:	8b 00                	mov    (%eax),%eax
c01062f3:	83 e0 07             	and    $0x7,%eax
c01062f6:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c01062f9:	eb 04                	jmp    c01062ff <get_pgtable_items+0x77>
            start ++;
c01062fb:	83 45 10 01          	addl   $0x1,0x10(%ebp)
    if (start < right) {
        if (left_store != NULL) {
            *left_store = start;
        }
        int perm = (table[start ++] & PTE_USER);
        while (start < right && (table[start] & PTE_USER) == perm) {
c01062ff:	8b 45 10             	mov    0x10(%ebp),%eax
c0106302:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0106305:	73 1d                	jae    c0106324 <get_pgtable_items+0x9c>
c0106307:	8b 45 10             	mov    0x10(%ebp),%eax
c010630a:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0106311:	8b 45 14             	mov    0x14(%ebp),%eax
c0106314:	01 d0                	add    %edx,%eax
c0106316:	8b 00                	mov    (%eax),%eax
c0106318:	83 e0 07             	and    $0x7,%eax
c010631b:	89 c2                	mov    %eax,%edx
c010631d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106320:	39 c2                	cmp    %eax,%edx
c0106322:	74 d7                	je     c01062fb <get_pgtable_items+0x73>
            start ++;
        }
        if (right_store != NULL) {
c0106324:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c0106328:	74 08                	je     c0106332 <get_pgtable_items+0xaa>
            *right_store = start;
c010632a:	8b 45 1c             	mov    0x1c(%ebp),%eax
c010632d:	8b 55 10             	mov    0x10(%ebp),%edx
c0106330:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c0106332:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0106335:	eb 05                	jmp    c010633c <get_pgtable_items+0xb4>
    }
    return 0;
c0106337:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010633c:	c9                   	leave  
c010633d:	c3                   	ret    

c010633e <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c010633e:	55                   	push   %ebp
c010633f:	89 e5                	mov    %esp,%ebp
c0106341:	57                   	push   %edi
c0106342:	56                   	push   %esi
c0106343:	53                   	push   %ebx
c0106344:	83 ec 4c             	sub    $0x4c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c0106347:	c7 04 24 28 ae 10 c0 	movl   $0xc010ae28,(%esp)
c010634e:	e8 00 a0 ff ff       	call   c0100353 <cprintf>
    size_t left, right = 0, perm;
c0106353:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c010635a:	e9 fa 00 00 00       	jmp    c0106459 <print_pgdir+0x11b>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c010635f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106362:	89 04 24             	mov    %eax,(%esp)
c0106365:	e8 d0 fe ff ff       	call   c010623a <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c010636a:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c010636d:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106370:	29 d1                	sub    %edx,%ecx
c0106372:	89 ca                	mov    %ecx,%edx
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0106374:	89 d6                	mov    %edx,%esi
c0106376:	c1 e6 16             	shl    $0x16,%esi
c0106379:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010637c:	89 d3                	mov    %edx,%ebx
c010637e:	c1 e3 16             	shl    $0x16,%ebx
c0106381:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0106384:	89 d1                	mov    %edx,%ecx
c0106386:	c1 e1 16             	shl    $0x16,%ecx
c0106389:	8b 7d dc             	mov    -0x24(%ebp),%edi
c010638c:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010638f:	29 d7                	sub    %edx,%edi
c0106391:	89 fa                	mov    %edi,%edx
c0106393:	89 44 24 14          	mov    %eax,0x14(%esp)
c0106397:	89 74 24 10          	mov    %esi,0x10(%esp)
c010639b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c010639f:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01063a3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01063a7:	c7 04 24 59 ae 10 c0 	movl   $0xc010ae59,(%esp)
c01063ae:	e8 a0 9f ff ff       	call   c0100353 <cprintf>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
c01063b3:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01063b6:	c1 e0 0a             	shl    $0xa,%eax
c01063b9:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c01063bc:	eb 54                	jmp    c0106412 <print_pgdir+0xd4>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c01063be:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01063c1:	89 04 24             	mov    %eax,(%esp)
c01063c4:	e8 71 fe ff ff       	call   c010623a <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c01063c9:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c01063cc:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01063cf:	29 d1                	sub    %edx,%ecx
c01063d1:	89 ca                	mov    %ecx,%edx
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c01063d3:	89 d6                	mov    %edx,%esi
c01063d5:	c1 e6 0c             	shl    $0xc,%esi
c01063d8:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01063db:	89 d3                	mov    %edx,%ebx
c01063dd:	c1 e3 0c             	shl    $0xc,%ebx
c01063e0:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01063e3:	c1 e2 0c             	shl    $0xc,%edx
c01063e6:	89 d1                	mov    %edx,%ecx
c01063e8:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c01063eb:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01063ee:	29 d7                	sub    %edx,%edi
c01063f0:	89 fa                	mov    %edi,%edx
c01063f2:	89 44 24 14          	mov    %eax,0x14(%esp)
c01063f6:	89 74 24 10          	mov    %esi,0x10(%esp)
c01063fa:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01063fe:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0106402:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106406:	c7 04 24 78 ae 10 c0 	movl   $0xc010ae78,(%esp)
c010640d:	e8 41 9f ff ff       	call   c0100353 <cprintf>
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
        size_t l, r = left * NPTEENTRY;
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0106412:	ba 00 00 c0 fa       	mov    $0xfac00000,%edx
c0106417:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010641a:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c010641d:	89 ce                	mov    %ecx,%esi
c010641f:	c1 e6 0a             	shl    $0xa,%esi
c0106422:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0106425:	89 cb                	mov    %ecx,%ebx
c0106427:	c1 e3 0a             	shl    $0xa,%ebx
c010642a:	8d 4d d4             	lea    -0x2c(%ebp),%ecx
c010642d:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c0106431:	8d 4d d8             	lea    -0x28(%ebp),%ecx
c0106434:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0106438:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010643c:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106440:	89 74 24 04          	mov    %esi,0x4(%esp)
c0106444:	89 1c 24             	mov    %ebx,(%esp)
c0106447:	e8 3c fe ff ff       	call   c0106288 <get_pgtable_items>
c010644c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010644f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0106453:	0f 85 65 ff ff ff    	jne    c01063be <print_pgdir+0x80>
//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
    cprintf("-------------------- BEGIN --------------------\n");
    size_t left, right = 0, perm;
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c0106459:	ba 00 b0 fe fa       	mov    $0xfafeb000,%edx
c010645e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106461:	8d 4d dc             	lea    -0x24(%ebp),%ecx
c0106464:	89 4c 24 14          	mov    %ecx,0x14(%esp)
c0106468:	8d 4d e0             	lea    -0x20(%ebp),%ecx
c010646b:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c010646f:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0106473:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106477:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c010647e:	00 
c010647f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0106486:	e8 fd fd ff ff       	call   c0106288 <get_pgtable_items>
c010648b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010648e:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0106492:	0f 85 c7 fe ff ff    	jne    c010635f <print_pgdir+0x21>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
        }
    }
    cprintf("--------------------- END ---------------------\n");
c0106498:	c7 04 24 9c ae 10 c0 	movl   $0xc010ae9c,(%esp)
c010649f:	e8 af 9e ff ff       	call   c0100353 <cprintf>
}
c01064a4:	83 c4 4c             	add    $0x4c,%esp
c01064a7:	5b                   	pop    %ebx
c01064a8:	5e                   	pop    %esi
c01064a9:	5f                   	pop    %edi
c01064aa:	5d                   	pop    %ebp
c01064ab:	c3                   	ret    

c01064ac <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c01064ac:	55                   	push   %ebp
c01064ad:	89 e5                	mov    %esp,%ebp
c01064af:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01064b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01064b5:	c1 e8 0c             	shr    $0xc,%eax
c01064b8:	89 c2                	mov    %eax,%edx
c01064ba:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01064bf:	39 c2                	cmp    %eax,%edx
c01064c1:	72 1c                	jb     c01064df <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01064c3:	c7 44 24 08 d0 ae 10 	movl   $0xc010aed0,0x8(%esp)
c01064ca:	c0 
c01064cb:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01064d2:	00 
c01064d3:	c7 04 24 ef ae 10 c0 	movl   $0xc010aeef,(%esp)
c01064da:	e8 44 a7 ff ff       	call   c0100c23 <__panic>
    }
    return &pages[PPN(pa)];
c01064df:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c01064e4:	8b 55 08             	mov    0x8(%ebp),%edx
c01064e7:	c1 ea 0c             	shr    $0xc,%edx
c01064ea:	c1 e2 05             	shl    $0x5,%edx
c01064ed:	01 d0                	add    %edx,%eax
}
c01064ef:	c9                   	leave  
c01064f0:	c3                   	ret    

c01064f1 <pte2page>:
kva2page(void *kva) {
    return pa2page(PADDR(kva));
}

static inline struct Page *
pte2page(pte_t pte) {
c01064f1:	55                   	push   %ebp
c01064f2:	89 e5                	mov    %esp,%ebp
c01064f4:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c01064f7:	8b 45 08             	mov    0x8(%ebp),%eax
c01064fa:	83 e0 01             	and    $0x1,%eax
c01064fd:	85 c0                	test   %eax,%eax
c01064ff:	75 1c                	jne    c010651d <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0106501:	c7 44 24 08 00 af 10 	movl   $0xc010af00,0x8(%esp)
c0106508:	c0 
c0106509:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0106510:	00 
c0106511:	c7 04 24 ef ae 10 c0 	movl   $0xc010aeef,(%esp)
c0106518:	e8 06 a7 ff ff       	call   c0100c23 <__panic>
    }
    return pa2page(PTE_ADDR(pte));
c010651d:	8b 45 08             	mov    0x8(%ebp),%eax
c0106520:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106525:	89 04 24             	mov    %eax,(%esp)
c0106528:	e8 7f ff ff ff       	call   c01064ac <pa2page>
}
c010652d:	c9                   	leave  
c010652e:	c3                   	ret    

c010652f <swap_init>:

static void check_swap(void);

int
swap_init(void)
{
c010652f:	55                   	push   %ebp
c0106530:	89 e5                	mov    %esp,%ebp
c0106532:	83 ec 28             	sub    $0x28,%esp
     swapfs_init();
c0106535:	e8 e1 1c 00 00       	call   c010821b <swapfs_init>

     if (!(1024 <= max_swap_offset && max_swap_offset < MAX_SWAP_OFFSET_LIMIT))
c010653a:	a1 dc 7b 12 c0       	mov    0xc0127bdc,%eax
c010653f:	3d ff 03 00 00       	cmp    $0x3ff,%eax
c0106544:	76 0c                	jbe    c0106552 <swap_init+0x23>
c0106546:	a1 dc 7b 12 c0       	mov    0xc0127bdc,%eax
c010654b:	3d ff ff ff 00       	cmp    $0xffffff,%eax
c0106550:	76 25                	jbe    c0106577 <swap_init+0x48>
     {
          panic("bad max_swap_offset %08x.\n", max_swap_offset);
c0106552:	a1 dc 7b 12 c0       	mov    0xc0127bdc,%eax
c0106557:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010655b:	c7 44 24 08 21 af 10 	movl   $0xc010af21,0x8(%esp)
c0106562:	c0 
c0106563:	c7 44 24 04 25 00 00 	movl   $0x25,0x4(%esp)
c010656a:	00 
c010656b:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106572:	e8 ac a6 ff ff       	call   c0100c23 <__panic>
     }
     

     sm = &swap_manager_fifo;
c0106577:	c7 05 d4 5a 12 c0 60 	movl   $0xc0124a60,0xc0125ad4
c010657e:	4a 12 c0 
     int r = sm->init();
c0106581:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c0106586:	8b 40 04             	mov    0x4(%eax),%eax
c0106589:	ff d0                	call   *%eax
c010658b:	89 45 f4             	mov    %eax,-0xc(%ebp)
     
     if (r == 0)
c010658e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106592:	75 26                	jne    c01065ba <swap_init+0x8b>
     {
          swap_init_ok = 1;
c0106594:	c7 05 cc 5a 12 c0 01 	movl   $0x1,0xc0125acc
c010659b:	00 00 00 
          cprintf("SWAP: manager = %s\n", sm->name);
c010659e:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c01065a3:	8b 00                	mov    (%eax),%eax
c01065a5:	89 44 24 04          	mov    %eax,0x4(%esp)
c01065a9:	c7 04 24 4b af 10 c0 	movl   $0xc010af4b,(%esp)
c01065b0:	e8 9e 9d ff ff       	call   c0100353 <cprintf>
          check_swap();
c01065b5:	e8 a4 04 00 00       	call   c0106a5e <check_swap>
     }

     return r;
c01065ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01065bd:	c9                   	leave  
c01065be:	c3                   	ret    

c01065bf <swap_init_mm>:

int
swap_init_mm(struct mm_struct *mm)
{
c01065bf:	55                   	push   %ebp
c01065c0:	89 e5                	mov    %esp,%ebp
c01065c2:	83 ec 18             	sub    $0x18,%esp
     return sm->init_mm(mm);
c01065c5:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c01065ca:	8b 40 08             	mov    0x8(%eax),%eax
c01065cd:	8b 55 08             	mov    0x8(%ebp),%edx
c01065d0:	89 14 24             	mov    %edx,(%esp)
c01065d3:	ff d0                	call   *%eax
}
c01065d5:	c9                   	leave  
c01065d6:	c3                   	ret    

c01065d7 <swap_tick_event>:

int
swap_tick_event(struct mm_struct *mm)
{
c01065d7:	55                   	push   %ebp
c01065d8:	89 e5                	mov    %esp,%ebp
c01065da:	83 ec 18             	sub    $0x18,%esp
     return sm->tick_event(mm);
c01065dd:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c01065e2:	8b 40 0c             	mov    0xc(%eax),%eax
c01065e5:	8b 55 08             	mov    0x8(%ebp),%edx
c01065e8:	89 14 24             	mov    %edx,(%esp)
c01065eb:	ff d0                	call   *%eax
}
c01065ed:	c9                   	leave  
c01065ee:	c3                   	ret    

c01065ef <swap_map_swappable>:

int
swap_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c01065ef:	55                   	push   %ebp
c01065f0:	89 e5                	mov    %esp,%ebp
c01065f2:	83 ec 18             	sub    $0x18,%esp
     return sm->map_swappable(mm, addr, page, swap_in);
c01065f5:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c01065fa:	8b 40 10             	mov    0x10(%eax),%eax
c01065fd:	8b 55 14             	mov    0x14(%ebp),%edx
c0106600:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0106604:	8b 55 10             	mov    0x10(%ebp),%edx
c0106607:	89 54 24 08          	mov    %edx,0x8(%esp)
c010660b:	8b 55 0c             	mov    0xc(%ebp),%edx
c010660e:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106612:	8b 55 08             	mov    0x8(%ebp),%edx
c0106615:	89 14 24             	mov    %edx,(%esp)
c0106618:	ff d0                	call   *%eax
}
c010661a:	c9                   	leave  
c010661b:	c3                   	ret    

c010661c <swap_set_unswappable>:

int
swap_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c010661c:	55                   	push   %ebp
c010661d:	89 e5                	mov    %esp,%ebp
c010661f:	83 ec 18             	sub    $0x18,%esp
     return sm->set_unswappable(mm, addr);
c0106622:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c0106627:	8b 40 14             	mov    0x14(%eax),%eax
c010662a:	8b 55 0c             	mov    0xc(%ebp),%edx
c010662d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106631:	8b 55 08             	mov    0x8(%ebp),%edx
c0106634:	89 14 24             	mov    %edx,(%esp)
c0106637:	ff d0                	call   *%eax
}
c0106639:	c9                   	leave  
c010663a:	c3                   	ret    

c010663b <swap_out>:

volatile unsigned int swap_out_num=0;

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
c010663b:	55                   	push   %ebp
c010663c:	89 e5                	mov    %esp,%ebp
c010663e:	83 ec 38             	sub    $0x38,%esp
     int i;
     for (i = 0; i != n; ++ i)
c0106641:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106648:	e9 5a 01 00 00       	jmp    c01067a7 <swap_out+0x16c>
     {
          uintptr_t v;
          //struct Page **ptr_page=NULL;
          struct Page *page;
          // cprintf("i %d, SWAP: call swap_out_victim\n",i);
          int r = sm->swap_out_victim(mm, &page, in_tick);
c010664d:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c0106652:	8b 40 18             	mov    0x18(%eax),%eax
c0106655:	8b 55 10             	mov    0x10(%ebp),%edx
c0106658:	89 54 24 08          	mov    %edx,0x8(%esp)
c010665c:	8d 55 e4             	lea    -0x1c(%ebp),%edx
c010665f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106663:	8b 55 08             	mov    0x8(%ebp),%edx
c0106666:	89 14 24             	mov    %edx,(%esp)
c0106669:	ff d0                	call   *%eax
c010666b:	89 45 f0             	mov    %eax,-0x10(%ebp)
          if (r != 0) {
c010666e:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0106672:	74 18                	je     c010668c <swap_out+0x51>
                    cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
c0106674:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106677:	89 44 24 04          	mov    %eax,0x4(%esp)
c010667b:	c7 04 24 60 af 10 c0 	movl   $0xc010af60,(%esp)
c0106682:	e8 cc 9c ff ff       	call   c0100353 <cprintf>
c0106687:	e9 27 01 00 00       	jmp    c01067b3 <swap_out+0x178>
          }          
          //assert(!PageReserved(page));

          //cprintf("SWAP: choose victim page 0x%08x\n", page);
          
          v=page->pra_vaddr; 
c010668c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010668f:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106692:	89 45 ec             	mov    %eax,-0x14(%ebp)
          pte_t *ptep = get_pte(mm->pgdir, v, 0);
c0106695:	8b 45 08             	mov    0x8(%ebp),%eax
c0106698:	8b 40 0c             	mov    0xc(%eax),%eax
c010669b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01066a2:	00 
c01066a3:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01066a6:	89 54 24 04          	mov    %edx,0x4(%esp)
c01066aa:	89 04 24             	mov    %eax,(%esp)
c01066ad:	e8 2a ed ff ff       	call   c01053dc <get_pte>
c01066b2:	89 45 e8             	mov    %eax,-0x18(%ebp)
          assert((*ptep & PTE_P) != 0);
c01066b5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01066b8:	8b 00                	mov    (%eax),%eax
c01066ba:	83 e0 01             	and    $0x1,%eax
c01066bd:	85 c0                	test   %eax,%eax
c01066bf:	75 24                	jne    c01066e5 <swap_out+0xaa>
c01066c1:	c7 44 24 0c 8d af 10 	movl   $0xc010af8d,0xc(%esp)
c01066c8:	c0 
c01066c9:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01066d0:	c0 
c01066d1:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c01066d8:	00 
c01066d9:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c01066e0:	e8 3e a5 ff ff       	call   c0100c23 <__panic>

          if (swapfs_write( (page->pra_vaddr/PGSIZE+1)<<8, page) != 0) {
c01066e5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01066e8:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01066eb:	8b 52 1c             	mov    0x1c(%edx),%edx
c01066ee:	c1 ea 0c             	shr    $0xc,%edx
c01066f1:	83 c2 01             	add    $0x1,%edx
c01066f4:	c1 e2 08             	shl    $0x8,%edx
c01066f7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01066fb:	89 14 24             	mov    %edx,(%esp)
c01066fe:	e8 d2 1b 00 00       	call   c01082d5 <swapfs_write>
c0106703:	85 c0                	test   %eax,%eax
c0106705:	74 34                	je     c010673b <swap_out+0x100>
                    cprintf("SWAP: failed to save\n");
c0106707:	c7 04 24 b7 af 10 c0 	movl   $0xc010afb7,(%esp)
c010670e:	e8 40 9c ff ff       	call   c0100353 <cprintf>
                    sm->map_swappable(mm, v, page, 0);
c0106713:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c0106718:	8b 40 10             	mov    0x10(%eax),%eax
c010671b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010671e:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0106725:	00 
c0106726:	89 54 24 08          	mov    %edx,0x8(%esp)
c010672a:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010672d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106731:	8b 55 08             	mov    0x8(%ebp),%edx
c0106734:	89 14 24             	mov    %edx,(%esp)
c0106737:	ff d0                	call   *%eax
c0106739:	eb 68                	jmp    c01067a3 <swap_out+0x168>
                    continue;
          }
          else {
                    cprintf("swap_out: i %d, store page in vaddr 0x%x to disk swap entry %d\n", i, v, page->pra_vaddr/PGSIZE+1);
c010673b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010673e:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106741:	c1 e8 0c             	shr    $0xc,%eax
c0106744:	83 c0 01             	add    $0x1,%eax
c0106747:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010674b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010674e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106752:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106755:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106759:	c7 04 24 d0 af 10 c0 	movl   $0xc010afd0,(%esp)
c0106760:	e8 ee 9b ff ff       	call   c0100353 <cprintf>
                    *ptep = (page->pra_vaddr/PGSIZE+1)<<8;
c0106765:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106768:	8b 40 1c             	mov    0x1c(%eax),%eax
c010676b:	c1 e8 0c             	shr    $0xc,%eax
c010676e:	83 c0 01             	add    $0x1,%eax
c0106771:	c1 e0 08             	shl    $0x8,%eax
c0106774:	89 c2                	mov    %eax,%edx
c0106776:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106779:	89 10                	mov    %edx,(%eax)
                    free_page(page);
c010677b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010677e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106785:	00 
c0106786:	89 04 24             	mov    %eax,(%esp)
c0106789:	e8 52 e5 ff ff       	call   c0104ce0 <free_pages>
          }
          
          tlb_invalidate(mm->pgdir, v);
c010678e:	8b 45 08             	mov    0x8(%ebp),%eax
c0106791:	8b 40 0c             	mov    0xc(%eax),%eax
c0106794:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106797:	89 54 24 04          	mov    %edx,0x4(%esp)
c010679b:	89 04 24             	mov    %eax,(%esp)
c010679e:	e8 28 ef ff ff       	call   c01056cb <tlb_invalidate>

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
     int i;
     for (i = 0; i != n; ++ i)
c01067a3:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c01067a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01067aa:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01067ad:	0f 85 9a fe ff ff    	jne    c010664d <swap_out+0x12>
                    free_page(page);
          }
          
          tlb_invalidate(mm->pgdir, v);
     }
     return i;
c01067b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01067b6:	c9                   	leave  
c01067b7:	c3                   	ret    

c01067b8 <swap_in>:

int
swap_in(struct mm_struct *mm, uintptr_t addr, struct Page **ptr_result)
{
c01067b8:	55                   	push   %ebp
c01067b9:	89 e5                	mov    %esp,%ebp
c01067bb:	83 ec 28             	sub    $0x28,%esp
     struct Page *result = alloc_page();
c01067be:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01067c5:	e8 ab e4 ff ff       	call   c0104c75 <alloc_pages>
c01067ca:	89 45 f4             	mov    %eax,-0xc(%ebp)
     assert(result!=NULL);
c01067cd:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01067d1:	75 24                	jne    c01067f7 <swap_in+0x3f>
c01067d3:	c7 44 24 0c 10 b0 10 	movl   $0xc010b010,0xc(%esp)
c01067da:	c0 
c01067db:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01067e2:	c0 
c01067e3:	c7 44 24 04 7b 00 00 	movl   $0x7b,0x4(%esp)
c01067ea:	00 
c01067eb:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c01067f2:	e8 2c a4 ff ff       	call   c0100c23 <__panic>

     pte_t *ptep = get_pte(mm->pgdir, addr, 0);
c01067f7:	8b 45 08             	mov    0x8(%ebp),%eax
c01067fa:	8b 40 0c             	mov    0xc(%eax),%eax
c01067fd:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106804:	00 
c0106805:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106808:	89 54 24 04          	mov    %edx,0x4(%esp)
c010680c:	89 04 24             	mov    %eax,(%esp)
c010680f:	e8 c8 eb ff ff       	call   c01053dc <get_pte>
c0106814:	89 45 f0             	mov    %eax,-0x10(%ebp)
     // cprintf("SWAP: load ptep %x swap entry %d to vaddr 0x%08x, page %x, No %d\n", ptep, (*ptep)>>8, addr, result, (result-pages));
    
     int r;
     if ((r = swapfs_read((*ptep), result)) != 0)
c0106817:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010681a:	8b 00                	mov    (%eax),%eax
c010681c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010681f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106823:	89 04 24             	mov    %eax,(%esp)
c0106826:	e8 38 1a 00 00       	call   c0108263 <swapfs_read>
c010682b:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010682e:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106832:	74 2a                	je     c010685e <swap_in+0xa6>
     {
        assert(r!=0);
c0106834:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0106838:	75 24                	jne    c010685e <swap_in+0xa6>
c010683a:	c7 44 24 0c 1d b0 10 	movl   $0xc010b01d,0xc(%esp)
c0106841:	c0 
c0106842:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106849:	c0 
c010684a:	c7 44 24 04 83 00 00 	movl   $0x83,0x4(%esp)
c0106851:	00 
c0106852:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106859:	e8 c5 a3 ff ff       	call   c0100c23 <__panic>
     }
     cprintf("swap_in: load disk swap entry %d with swap_page in vadr 0x%x\n", (*ptep)>>8, addr);
c010685e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106861:	8b 00                	mov    (%eax),%eax
c0106863:	c1 e8 08             	shr    $0x8,%eax
c0106866:	89 c2                	mov    %eax,%edx
c0106868:	8b 45 0c             	mov    0xc(%ebp),%eax
c010686b:	89 44 24 08          	mov    %eax,0x8(%esp)
c010686f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106873:	c7 04 24 24 b0 10 c0 	movl   $0xc010b024,(%esp)
c010687a:	e8 d4 9a ff ff       	call   c0100353 <cprintf>
     *ptr_result=result;
c010687f:	8b 45 10             	mov    0x10(%ebp),%eax
c0106882:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0106885:	89 10                	mov    %edx,(%eax)
     return 0;
c0106887:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010688c:	c9                   	leave  
c010688d:	c3                   	ret    

c010688e <check_content_set>:



static inline void
check_content_set(void)
{
c010688e:	55                   	push   %ebp
c010688f:	89 e5                	mov    %esp,%ebp
c0106891:	83 ec 18             	sub    $0x18,%esp
     *(unsigned char *)0x1000 = 0x0a;
c0106894:	b8 00 10 00 00       	mov    $0x1000,%eax
c0106899:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c010689c:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01068a1:	83 f8 01             	cmp    $0x1,%eax
c01068a4:	74 24                	je     c01068ca <check_content_set+0x3c>
c01068a6:	c7 44 24 0c 62 b0 10 	movl   $0xc010b062,0xc(%esp)
c01068ad:	c0 
c01068ae:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01068b5:	c0 
c01068b6:	c7 44 24 04 90 00 00 	movl   $0x90,0x4(%esp)
c01068bd:	00 
c01068be:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c01068c5:	e8 59 a3 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x1010 = 0x0a;
c01068ca:	b8 10 10 00 00       	mov    $0x1010,%eax
c01068cf:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c01068d2:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01068d7:	83 f8 01             	cmp    $0x1,%eax
c01068da:	74 24                	je     c0106900 <check_content_set+0x72>
c01068dc:	c7 44 24 0c 62 b0 10 	movl   $0xc010b062,0xc(%esp)
c01068e3:	c0 
c01068e4:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01068eb:	c0 
c01068ec:	c7 44 24 04 92 00 00 	movl   $0x92,0x4(%esp)
c01068f3:	00 
c01068f4:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c01068fb:	e8 23 a3 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x2000 = 0x0b;
c0106900:	b8 00 20 00 00       	mov    $0x2000,%eax
c0106905:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0106908:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c010690d:	83 f8 02             	cmp    $0x2,%eax
c0106910:	74 24                	je     c0106936 <check_content_set+0xa8>
c0106912:	c7 44 24 0c 71 b0 10 	movl   $0xc010b071,0xc(%esp)
c0106919:	c0 
c010691a:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106921:	c0 
c0106922:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c0106929:	00 
c010692a:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106931:	e8 ed a2 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x2010 = 0x0b;
c0106936:	b8 10 20 00 00       	mov    $0x2010,%eax
c010693b:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c010693e:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0106943:	83 f8 02             	cmp    $0x2,%eax
c0106946:	74 24                	je     c010696c <check_content_set+0xde>
c0106948:	c7 44 24 0c 71 b0 10 	movl   $0xc010b071,0xc(%esp)
c010694f:	c0 
c0106950:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106957:	c0 
c0106958:	c7 44 24 04 96 00 00 	movl   $0x96,0x4(%esp)
c010695f:	00 
c0106960:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106967:	e8 b7 a2 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x3000 = 0x0c;
c010696c:	b8 00 30 00 00       	mov    $0x3000,%eax
c0106971:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0106974:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0106979:	83 f8 03             	cmp    $0x3,%eax
c010697c:	74 24                	je     c01069a2 <check_content_set+0x114>
c010697e:	c7 44 24 0c 80 b0 10 	movl   $0xc010b080,0xc(%esp)
c0106985:	c0 
c0106986:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c010698d:	c0 
c010698e:	c7 44 24 04 98 00 00 	movl   $0x98,0x4(%esp)
c0106995:	00 
c0106996:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c010699d:	e8 81 a2 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x3010 = 0x0c;
c01069a2:	b8 10 30 00 00       	mov    $0x3010,%eax
c01069a7:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c01069aa:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01069af:	83 f8 03             	cmp    $0x3,%eax
c01069b2:	74 24                	je     c01069d8 <check_content_set+0x14a>
c01069b4:	c7 44 24 0c 80 b0 10 	movl   $0xc010b080,0xc(%esp)
c01069bb:	c0 
c01069bc:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01069c3:	c0 
c01069c4:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c01069cb:	00 
c01069cc:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c01069d3:	e8 4b a2 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x4000 = 0x0d;
c01069d8:	b8 00 40 00 00       	mov    $0x4000,%eax
c01069dd:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c01069e0:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01069e5:	83 f8 04             	cmp    $0x4,%eax
c01069e8:	74 24                	je     c0106a0e <check_content_set+0x180>
c01069ea:	c7 44 24 0c 8f b0 10 	movl   $0xc010b08f,0xc(%esp)
c01069f1:	c0 
c01069f2:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c01069f9:	c0 
c01069fa:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c0106a01:	00 
c0106a02:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106a09:	e8 15 a2 ff ff       	call   c0100c23 <__panic>
     *(unsigned char *)0x4010 = 0x0d;
c0106a0e:	b8 10 40 00 00       	mov    $0x4010,%eax
c0106a13:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0106a16:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0106a1b:	83 f8 04             	cmp    $0x4,%eax
c0106a1e:	74 24                	je     c0106a44 <check_content_set+0x1b6>
c0106a20:	c7 44 24 0c 8f b0 10 	movl   $0xc010b08f,0xc(%esp)
c0106a27:	c0 
c0106a28:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106a2f:	c0 
c0106a30:	c7 44 24 04 9e 00 00 	movl   $0x9e,0x4(%esp)
c0106a37:	00 
c0106a38:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106a3f:	e8 df a1 ff ff       	call   c0100c23 <__panic>
}
c0106a44:	c9                   	leave  
c0106a45:	c3                   	ret    

c0106a46 <check_content_access>:

static inline int
check_content_access(void)
{
c0106a46:	55                   	push   %ebp
c0106a47:	89 e5                	mov    %esp,%ebp
c0106a49:	83 ec 18             	sub    $0x18,%esp
    int ret = sm->check_swap();
c0106a4c:	a1 d4 5a 12 c0       	mov    0xc0125ad4,%eax
c0106a51:	8b 40 1c             	mov    0x1c(%eax),%eax
c0106a54:	ff d0                	call   *%eax
c0106a56:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ret;
c0106a59:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106a5c:	c9                   	leave  
c0106a5d:	c3                   	ret    

c0106a5e <check_swap>:
#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
check_swap(void)
{
c0106a5e:	55                   	push   %ebp
c0106a5f:	89 e5                	mov    %esp,%ebp
c0106a61:	53                   	push   %ebx
c0106a62:	83 ec 74             	sub    $0x74,%esp
    //backup mem env
     int ret, count = 0, total = 0, i;
c0106a65:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0106a6c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
     list_entry_t *le = &free_list;
c0106a73:	c7 45 e8 18 7b 12 c0 	movl   $0xc0127b18,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0106a7a:	eb 6b                	jmp    c0106ae7 <check_swap+0x89>
        struct Page *p = le2page(le, page_link);
c0106a7c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106a7f:	83 e8 0c             	sub    $0xc,%eax
c0106a82:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        assert(PageProperty(p));
c0106a85:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106a88:	83 c0 04             	add    $0x4,%eax
c0106a8b:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c0106a92:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0106a95:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0106a98:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0106a9b:	0f a3 10             	bt     %edx,(%eax)
c0106a9e:	19 c0                	sbb    %eax,%eax
c0106aa0:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c0106aa3:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0106aa7:	0f 95 c0             	setne  %al
c0106aaa:	0f b6 c0             	movzbl %al,%eax
c0106aad:	85 c0                	test   %eax,%eax
c0106aaf:	75 24                	jne    c0106ad5 <check_swap+0x77>
c0106ab1:	c7 44 24 0c 9e b0 10 	movl   $0xc010b09e,0xc(%esp)
c0106ab8:	c0 
c0106ab9:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106ac0:	c0 
c0106ac1:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c0106ac8:	00 
c0106ac9:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106ad0:	e8 4e a1 ff ff       	call   c0100c23 <__panic>
        count ++, total += p->property;
c0106ad5:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0106ad9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106adc:	8b 50 08             	mov    0x8(%eax),%edx
c0106adf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106ae2:	01 d0                	add    %edx,%eax
c0106ae4:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106ae7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106aea:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0106aed:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0106af0:	8b 40 04             	mov    0x4(%eax),%eax
check_swap(void)
{
    //backup mem env
     int ret, count = 0, total = 0, i;
     list_entry_t *le = &free_list;
     while ((le = list_next(le)) != &free_list) {
c0106af3:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106af6:	81 7d e8 18 7b 12 c0 	cmpl   $0xc0127b18,-0x18(%ebp)
c0106afd:	0f 85 79 ff ff ff    	jne    c0106a7c <check_swap+0x1e>
        struct Page *p = le2page(le, page_link);
        assert(PageProperty(p));
        count ++, total += p->property;
     }
     assert(total == nr_free_pages());
c0106b03:	8b 5d f0             	mov    -0x10(%ebp),%ebx
c0106b06:	e8 07 e2 ff ff       	call   c0104d12 <nr_free_pages>
c0106b0b:	39 c3                	cmp    %eax,%ebx
c0106b0d:	74 24                	je     c0106b33 <check_swap+0xd5>
c0106b0f:	c7 44 24 0c ae b0 10 	movl   $0xc010b0ae,0xc(%esp)
c0106b16:	c0 
c0106b17:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106b1e:	c0 
c0106b1f:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0106b26:	00 
c0106b27:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106b2e:	e8 f0 a0 ff ff       	call   c0100c23 <__panic>
     cprintf("BEGIN check_swap: count %d, total %d\n",count,total);
c0106b33:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106b36:	89 44 24 08          	mov    %eax,0x8(%esp)
c0106b3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106b3d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106b41:	c7 04 24 c8 b0 10 c0 	movl   $0xc010b0c8,(%esp)
c0106b48:	e8 06 98 ff ff       	call   c0100353 <cprintf>
     
     //now we set the phy pages env     
     struct mm_struct *mm = mm_create();
c0106b4d:	e8 47 0a 00 00       	call   c0107599 <mm_create>
c0106b52:	89 45 e0             	mov    %eax,-0x20(%ebp)
     assert(mm != NULL);
c0106b55:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0106b59:	75 24                	jne    c0106b7f <check_swap+0x121>
c0106b5b:	c7 44 24 0c ee b0 10 	movl   $0xc010b0ee,0xc(%esp)
c0106b62:	c0 
c0106b63:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106b6a:	c0 
c0106b6b:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c0106b72:	00 
c0106b73:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106b7a:	e8 a4 a0 ff ff       	call   c0100c23 <__panic>

     extern struct mm_struct *check_mm_struct;
     assert(check_mm_struct == NULL);
c0106b7f:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c0106b84:	85 c0                	test   %eax,%eax
c0106b86:	74 24                	je     c0106bac <check_swap+0x14e>
c0106b88:	c7 44 24 0c f9 b0 10 	movl   $0xc010b0f9,0xc(%esp)
c0106b8f:	c0 
c0106b90:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106b97:	c0 
c0106b98:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c0106b9f:	00 
c0106ba0:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106ba7:	e8 77 a0 ff ff       	call   c0100c23 <__panic>

     check_mm_struct = mm;
c0106bac:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106baf:	a3 0c 7c 12 c0       	mov    %eax,0xc0127c0c

     pde_t *pgdir = mm->pgdir = boot_pgdir;
c0106bb4:	8b 15 44 5a 12 c0    	mov    0xc0125a44,%edx
c0106bba:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106bbd:	89 50 0c             	mov    %edx,0xc(%eax)
c0106bc0:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106bc3:	8b 40 0c             	mov    0xc(%eax),%eax
c0106bc6:	89 45 dc             	mov    %eax,-0x24(%ebp)
     assert(pgdir[0] == 0);
c0106bc9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106bcc:	8b 00                	mov    (%eax),%eax
c0106bce:	85 c0                	test   %eax,%eax
c0106bd0:	74 24                	je     c0106bf6 <check_swap+0x198>
c0106bd2:	c7 44 24 0c 11 b1 10 	movl   $0xc010b111,0xc(%esp)
c0106bd9:	c0 
c0106bda:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106be1:	c0 
c0106be2:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c0106be9:	00 
c0106bea:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106bf1:	e8 2d a0 ff ff       	call   c0100c23 <__panic>

     struct vma_struct *vma = vma_create(BEING_CHECK_VALID_VADDR, CHECK_VALID_VADDR, VM_WRITE | VM_READ);
c0106bf6:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
c0106bfd:	00 
c0106bfe:	c7 44 24 04 00 60 00 	movl   $0x6000,0x4(%esp)
c0106c05:	00 
c0106c06:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
c0106c0d:	e8 ff 09 00 00       	call   c0107611 <vma_create>
c0106c12:	89 45 d8             	mov    %eax,-0x28(%ebp)
     assert(vma != NULL);
c0106c15:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0106c19:	75 24                	jne    c0106c3f <check_swap+0x1e1>
c0106c1b:	c7 44 24 0c 1f b1 10 	movl   $0xc010b11f,0xc(%esp)
c0106c22:	c0 
c0106c23:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106c2a:	c0 
c0106c2b:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c0106c32:	00 
c0106c33:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106c3a:	e8 e4 9f ff ff       	call   c0100c23 <__panic>

     insert_vma_struct(mm, vma);
c0106c3f:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106c42:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106c46:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106c49:	89 04 24             	mov    %eax,(%esp)
c0106c4c:	e8 50 0b 00 00       	call   c01077a1 <insert_vma_struct>

     //setup the temp Page Table vaddr 0~4MB
     cprintf("setup Page Table for vaddr 0X1000, so alloc a page\n");
c0106c51:	c7 04 24 2c b1 10 c0 	movl   $0xc010b12c,(%esp)
c0106c58:	e8 f6 96 ff ff       	call   c0100353 <cprintf>
     pte_t *temp_ptep=NULL;
c0106c5d:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
c0106c64:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106c67:	8b 40 0c             	mov    0xc(%eax),%eax
c0106c6a:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0106c71:	00 
c0106c72:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0106c79:	00 
c0106c7a:	89 04 24             	mov    %eax,(%esp)
c0106c7d:	e8 5a e7 ff ff       	call   c01053dc <get_pte>
c0106c82:	89 45 d4             	mov    %eax,-0x2c(%ebp)
     assert(temp_ptep!= NULL);
c0106c85:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c0106c89:	75 24                	jne    c0106caf <check_swap+0x251>
c0106c8b:	c7 44 24 0c 60 b1 10 	movl   $0xc010b160,0xc(%esp)
c0106c92:	c0 
c0106c93:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106c9a:	c0 
c0106c9b:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c0106ca2:	00 
c0106ca3:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106caa:	e8 74 9f ff ff       	call   c0100c23 <__panic>
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
c0106caf:	c7 04 24 74 b1 10 c0 	movl   $0xc010b174,(%esp)
c0106cb6:	e8 98 96 ff ff       	call   c0100353 <cprintf>
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106cbb:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106cc2:	e9 a3 00 00 00       	jmp    c0106d6a <check_swap+0x30c>
          check_rp[i] = alloc_page();
c0106cc7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106cce:	e8 a2 df ff ff       	call   c0104c75 <alloc_pages>
c0106cd3:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106cd6:	89 04 95 40 7b 12 c0 	mov    %eax,-0x3fed84c0(,%edx,4)
          assert(check_rp[i] != NULL );
c0106cdd:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106ce0:	8b 04 85 40 7b 12 c0 	mov    -0x3fed84c0(,%eax,4),%eax
c0106ce7:	85 c0                	test   %eax,%eax
c0106ce9:	75 24                	jne    c0106d0f <check_swap+0x2b1>
c0106ceb:	c7 44 24 0c 98 b1 10 	movl   $0xc010b198,0xc(%esp)
c0106cf2:	c0 
c0106cf3:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106cfa:	c0 
c0106cfb:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c0106d02:	00 
c0106d03:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106d0a:	e8 14 9f ff ff       	call   c0100c23 <__panic>
          assert(!PageProperty(check_rp[i]));
c0106d0f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106d12:	8b 04 85 40 7b 12 c0 	mov    -0x3fed84c0(,%eax,4),%eax
c0106d19:	83 c0 04             	add    $0x4,%eax
c0106d1c:	c7 45 b4 01 00 00 00 	movl   $0x1,-0x4c(%ebp)
c0106d23:	89 45 b0             	mov    %eax,-0x50(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0106d26:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0106d29:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0106d2c:	0f a3 10             	bt     %edx,(%eax)
c0106d2f:	19 c0                	sbb    %eax,%eax
c0106d31:	89 45 ac             	mov    %eax,-0x54(%ebp)
    return oldbit != 0;
c0106d34:	83 7d ac 00          	cmpl   $0x0,-0x54(%ebp)
c0106d38:	0f 95 c0             	setne  %al
c0106d3b:	0f b6 c0             	movzbl %al,%eax
c0106d3e:	85 c0                	test   %eax,%eax
c0106d40:	74 24                	je     c0106d66 <check_swap+0x308>
c0106d42:	c7 44 24 0c ac b1 10 	movl   $0xc010b1ac,0xc(%esp)
c0106d49:	c0 
c0106d4a:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106d51:	c0 
c0106d52:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c0106d59:	00 
c0106d5a:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106d61:	e8 bd 9e ff ff       	call   c0100c23 <__panic>
     pte_t *temp_ptep=NULL;
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
     assert(temp_ptep!= NULL);
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106d66:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106d6a:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106d6e:	0f 8e 53 ff ff ff    	jle    c0106cc7 <check_swap+0x269>
          check_rp[i] = alloc_page();
          assert(check_rp[i] != NULL );
          assert(!PageProperty(check_rp[i]));
     }
     list_entry_t free_list_store = free_list;
c0106d74:	a1 18 7b 12 c0       	mov    0xc0127b18,%eax
c0106d79:	8b 15 1c 7b 12 c0    	mov    0xc0127b1c,%edx
c0106d7f:	89 45 98             	mov    %eax,-0x68(%ebp)
c0106d82:	89 55 9c             	mov    %edx,-0x64(%ebp)
c0106d85:	c7 45 a8 18 7b 12 c0 	movl   $0xc0127b18,-0x58(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0106d8c:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0106d8f:	8b 55 a8             	mov    -0x58(%ebp),%edx
c0106d92:	89 50 04             	mov    %edx,0x4(%eax)
c0106d95:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0106d98:	8b 50 04             	mov    0x4(%eax),%edx
c0106d9b:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0106d9e:	89 10                	mov    %edx,(%eax)
c0106da0:	c7 45 a4 18 7b 12 c0 	movl   $0xc0127b18,-0x5c(%ebp)
 * list_empty - tests whether a list is empty
 * @list:       the list to test.
 * */
static inline bool
list_empty(list_entry_t *list) {
    return list->next == list;
c0106da7:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c0106daa:	8b 40 04             	mov    0x4(%eax),%eax
c0106dad:	39 45 a4             	cmp    %eax,-0x5c(%ebp)
c0106db0:	0f 94 c0             	sete   %al
c0106db3:	0f b6 c0             	movzbl %al,%eax
     list_init(&free_list);
     assert(list_empty(&free_list));
c0106db6:	85 c0                	test   %eax,%eax
c0106db8:	75 24                	jne    c0106dde <check_swap+0x380>
c0106dba:	c7 44 24 0c c7 b1 10 	movl   $0xc010b1c7,0xc(%esp)
c0106dc1:	c0 
c0106dc2:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106dc9:	c0 
c0106dca:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c0106dd1:	00 
c0106dd2:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106dd9:	e8 45 9e ff ff       	call   c0100c23 <__panic>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
c0106dde:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0106de3:	89 45 d0             	mov    %eax,-0x30(%ebp)
     nr_free = 0;
c0106de6:	c7 05 20 7b 12 c0 00 	movl   $0x0,0xc0127b20
c0106ded:	00 00 00 
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106df0:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106df7:	eb 1e                	jmp    c0106e17 <check_swap+0x3b9>
        free_pages(check_rp[i],1);
c0106df9:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106dfc:	8b 04 85 40 7b 12 c0 	mov    -0x3fed84c0(,%eax,4),%eax
c0106e03:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106e0a:	00 
c0106e0b:	89 04 24             	mov    %eax,(%esp)
c0106e0e:	e8 cd de ff ff       	call   c0104ce0 <free_pages>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
     nr_free = 0;
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106e13:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106e17:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106e1b:	7e dc                	jle    c0106df9 <check_swap+0x39b>
        free_pages(check_rp[i],1);
     }
     assert(nr_free==CHECK_VALID_PHY_PAGE_NUM);
c0106e1d:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0106e22:	83 f8 04             	cmp    $0x4,%eax
c0106e25:	74 24                	je     c0106e4b <check_swap+0x3ed>
c0106e27:	c7 44 24 0c e0 b1 10 	movl   $0xc010b1e0,0xc(%esp)
c0106e2e:	c0 
c0106e2f:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106e36:	c0 
c0106e37:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c0106e3e:	00 
c0106e3f:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106e46:	e8 d8 9d ff ff       	call   c0100c23 <__panic>
     
     cprintf("set up init env for check_swap begin!\n");
c0106e4b:	c7 04 24 04 b2 10 c0 	movl   $0xc010b204,(%esp)
c0106e52:	e8 fc 94 ff ff       	call   c0100353 <cprintf>
     //setup initial vir_page<->phy_page environment for page relpacement algorithm 

     
     pgfault_num=0;
c0106e57:	c7 05 d8 5a 12 c0 00 	movl   $0x0,0xc0125ad8
c0106e5e:	00 00 00 
     
     check_content_set();
c0106e61:	e8 28 fa ff ff       	call   c010688e <check_content_set>
     assert( nr_free == 0);         
c0106e66:	a1 20 7b 12 c0       	mov    0xc0127b20,%eax
c0106e6b:	85 c0                	test   %eax,%eax
c0106e6d:	74 24                	je     c0106e93 <check_swap+0x435>
c0106e6f:	c7 44 24 0c 2b b2 10 	movl   $0xc010b22b,0xc(%esp)
c0106e76:	c0 
c0106e77:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106e7e:	c0 
c0106e7f:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c0106e86:	00 
c0106e87:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106e8e:	e8 90 9d ff ff       	call   c0100c23 <__panic>
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c0106e93:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106e9a:	eb 26                	jmp    c0106ec2 <check_swap+0x464>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
c0106e9c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106e9f:	c7 04 85 60 7b 12 c0 	movl   $0xffffffff,-0x3fed84a0(,%eax,4)
c0106ea6:	ff ff ff ff 
c0106eaa:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106ead:	8b 14 85 60 7b 12 c0 	mov    -0x3fed84a0(,%eax,4),%edx
c0106eb4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106eb7:	89 14 85 a0 7b 12 c0 	mov    %edx,-0x3fed8460(,%eax,4)
     
     pgfault_num=0;
     
     check_content_set();
     assert( nr_free == 0);         
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c0106ebe:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106ec2:	83 7d ec 09          	cmpl   $0x9,-0x14(%ebp)
c0106ec6:	7e d4                	jle    c0106e9c <check_swap+0x43e>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106ec8:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0106ecf:	e9 eb 00 00 00       	jmp    c0106fbf <check_swap+0x561>
         check_ptep[i]=0;
c0106ed4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106ed7:	c7 04 85 f4 7b 12 c0 	movl   $0x0,-0x3fed840c(,%eax,4)
c0106ede:	00 00 00 00 
         check_ptep[i] = get_pte(pgdir, (i+1)*0x1000, 0);
c0106ee2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106ee5:	83 c0 01             	add    $0x1,%eax
c0106ee8:	c1 e0 0c             	shl    $0xc,%eax
c0106eeb:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106ef2:	00 
c0106ef3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106ef7:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106efa:	89 04 24             	mov    %eax,(%esp)
c0106efd:	e8 da e4 ff ff       	call   c01053dc <get_pte>
c0106f02:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106f05:	89 04 95 f4 7b 12 c0 	mov    %eax,-0x3fed840c(,%edx,4)
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
c0106f0c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f0f:	8b 04 85 f4 7b 12 c0 	mov    -0x3fed840c(,%eax,4),%eax
c0106f16:	85 c0                	test   %eax,%eax
c0106f18:	75 24                	jne    c0106f3e <check_swap+0x4e0>
c0106f1a:	c7 44 24 0c 38 b2 10 	movl   $0xc010b238,0xc(%esp)
c0106f21:	c0 
c0106f22:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106f29:	c0 
c0106f2a:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0106f31:	00 
c0106f32:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106f39:	e8 e5 9c ff ff       	call   c0100c23 <__panic>
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
c0106f3e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f41:	8b 04 85 f4 7b 12 c0 	mov    -0x3fed840c(,%eax,4),%eax
c0106f48:	8b 00                	mov    (%eax),%eax
c0106f4a:	89 04 24             	mov    %eax,(%esp)
c0106f4d:	e8 9f f5 ff ff       	call   c01064f1 <pte2page>
c0106f52:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0106f55:	8b 14 95 40 7b 12 c0 	mov    -0x3fed84c0(,%edx,4),%edx
c0106f5c:	39 d0                	cmp    %edx,%eax
c0106f5e:	74 24                	je     c0106f84 <check_swap+0x526>
c0106f60:	c7 44 24 0c 50 b2 10 	movl   $0xc010b250,0xc(%esp)
c0106f67:	c0 
c0106f68:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106f6f:	c0 
c0106f70:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0106f77:	00 
c0106f78:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106f7f:	e8 9f 9c ff ff       	call   c0100c23 <__panic>
         assert((*check_ptep[i] & PTE_P));          
c0106f84:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106f87:	8b 04 85 f4 7b 12 c0 	mov    -0x3fed840c(,%eax,4),%eax
c0106f8e:	8b 00                	mov    (%eax),%eax
c0106f90:	83 e0 01             	and    $0x1,%eax
c0106f93:	85 c0                	test   %eax,%eax
c0106f95:	75 24                	jne    c0106fbb <check_swap+0x55d>
c0106f97:	c7 44 24 0c 78 b2 10 	movl   $0xc010b278,0xc(%esp)
c0106f9e:	c0 
c0106f9f:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106fa6:	c0 
c0106fa7:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0106fae:	00 
c0106faf:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0106fb6:	e8 68 9c ff ff       	call   c0100c23 <__panic>
     check_content_set();
     assert( nr_free == 0);         
     for(i = 0; i<MAX_SEQ_NO ; i++) 
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0106fbb:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c0106fbf:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0106fc3:	0f 8e 0b ff ff ff    	jle    c0106ed4 <check_swap+0x476>
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
         assert((*check_ptep[i] & PTE_P));          
     }
     cprintf("set up init env for check_swap over!\n");
c0106fc9:	c7 04 24 94 b2 10 c0 	movl   $0xc010b294,(%esp)
c0106fd0:	e8 7e 93 ff ff       	call   c0100353 <cprintf>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
c0106fd5:	e8 6c fa ff ff       	call   c0106a46 <check_content_access>
c0106fda:	89 45 cc             	mov    %eax,-0x34(%ebp)
     assert(ret==0);
c0106fdd:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0106fe1:	74 24                	je     c0107007 <check_swap+0x5a9>
c0106fe3:	c7 44 24 0c ba b2 10 	movl   $0xc010b2ba,0xc(%esp)
c0106fea:	c0 
c0106feb:	c7 44 24 08 a2 af 10 	movl   $0xc010afa2,0x8(%esp)
c0106ff2:	c0 
c0106ff3:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c0106ffa:	00 
c0106ffb:	c7 04 24 3c af 10 c0 	movl   $0xc010af3c,(%esp)
c0107002:	e8 1c 9c ff ff       	call   c0100c23 <__panic>
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0107007:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c010700e:	eb 1e                	jmp    c010702e <check_swap+0x5d0>
         free_pages(check_rp[i],1);
c0107010:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107013:	8b 04 85 40 7b 12 c0 	mov    -0x3fed84c0(,%eax,4),%eax
c010701a:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107021:	00 
c0107022:	89 04 24             	mov    %eax,(%esp)
c0107025:	e8 b6 dc ff ff       	call   c0104ce0 <free_pages>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
     assert(ret==0);
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c010702a:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
c010702e:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0107032:	7e dc                	jle    c0107010 <check_swap+0x5b2>
         free_pages(check_rp[i],1);
     } 

     //free_page(pte2page(*temp_ptep));
     
     mm_destroy(mm);
c0107034:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107037:	89 04 24             	mov    %eax,(%esp)
c010703a:	e8 92 08 00 00       	call   c01078d1 <mm_destroy>
         
     nr_free = nr_free_store;
c010703f:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107042:	a3 20 7b 12 c0       	mov    %eax,0xc0127b20
     free_list = free_list_store;
c0107047:	8b 45 98             	mov    -0x68(%ebp),%eax
c010704a:	8b 55 9c             	mov    -0x64(%ebp),%edx
c010704d:	a3 18 7b 12 c0       	mov    %eax,0xc0127b18
c0107052:	89 15 1c 7b 12 c0    	mov    %edx,0xc0127b1c

     
     le = &free_list;
c0107058:	c7 45 e8 18 7b 12 c0 	movl   $0xc0127b18,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c010705f:	eb 1d                	jmp    c010707e <check_swap+0x620>
         struct Page *p = le2page(le, page_link);
c0107061:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107064:	83 e8 0c             	sub    $0xc,%eax
c0107067:	89 45 c8             	mov    %eax,-0x38(%ebp)
         count --, total -= p->property;
c010706a:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c010706e:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0107071:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107074:	8b 40 08             	mov    0x8(%eax),%eax
c0107077:	29 c2                	sub    %eax,%edx
c0107079:	89 d0                	mov    %edx,%eax
c010707b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010707e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107081:	89 45 a0             	mov    %eax,-0x60(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0107084:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0107087:	8b 40 04             	mov    0x4(%eax),%eax
     nr_free = nr_free_store;
     free_list = free_list_store;

     
     le = &free_list;
     while ((le = list_next(le)) != &free_list) {
c010708a:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010708d:	81 7d e8 18 7b 12 c0 	cmpl   $0xc0127b18,-0x18(%ebp)
c0107094:	75 cb                	jne    c0107061 <check_swap+0x603>
         struct Page *p = le2page(le, page_link);
         count --, total -= p->property;
     }
     cprintf("count is %d, total is %d\n",count,total);
c0107096:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107099:	89 44 24 08          	mov    %eax,0x8(%esp)
c010709d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01070a0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01070a4:	c7 04 24 c1 b2 10 c0 	movl   $0xc010b2c1,(%esp)
c01070ab:	e8 a3 92 ff ff       	call   c0100353 <cprintf>
     //assert(count == 0);
     
     cprintf("check_swap() succeeded!\n");
c01070b0:	c7 04 24 db b2 10 c0 	movl   $0xc010b2db,(%esp)
c01070b7:	e8 97 92 ff ff       	call   c0100353 <cprintf>
}
c01070bc:	83 c4 74             	add    $0x74,%esp
c01070bf:	5b                   	pop    %ebx
c01070c0:	5d                   	pop    %ebp
c01070c1:	c3                   	ret    

c01070c2 <_fifo_init_mm>:
 * (2) _fifo_init_mm: init pra_list_head and let  mm->sm_priv point to the addr of pra_list_head.
 *              Now, From the memory control struct mm_struct, we can access FIFO PRA
 */
static int
_fifo_init_mm(struct mm_struct *mm)
{     
c01070c2:	55                   	push   %ebp
c01070c3:	89 e5                	mov    %esp,%ebp
c01070c5:	83 ec 10             	sub    $0x10,%esp
c01070c8:	c7 45 fc 04 7c 12 c0 	movl   $0xc0127c04,-0x4(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01070cf:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01070d2:	8b 55 fc             	mov    -0x4(%ebp),%edx
c01070d5:	89 50 04             	mov    %edx,0x4(%eax)
c01070d8:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01070db:	8b 50 04             	mov    0x4(%eax),%edx
c01070de:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01070e1:	89 10                	mov    %edx,(%eax)
     list_init(&pra_list_head);
     mm->sm_priv = &pra_list_head;
c01070e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01070e6:	c7 40 14 04 7c 12 c0 	movl   $0xc0127c04,0x14(%eax)
     //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv);
     return 0;
c01070ed:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01070f2:	c9                   	leave  
c01070f3:	c3                   	ret    

c01070f4 <_fifo_map_swappable>:
/*
 * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue
 */
static int
_fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c01070f4:	55                   	push   %ebp
c01070f5:	89 e5                	mov    %esp,%ebp
c01070f7:	83 ec 48             	sub    $0x48,%esp
    list_entry_t *head=(list_entry_t*) mm->sm_priv;
c01070fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01070fd:	8b 40 14             	mov    0x14(%eax),%eax
c0107100:	89 45 f4             	mov    %eax,-0xc(%ebp)
    list_entry_t *entry=&(page->pra_page_link);
c0107103:	8b 45 10             	mov    0x10(%ebp),%eax
c0107106:	83 c0 14             	add    $0x14,%eax
c0107109:	89 45 f0             	mov    %eax,-0x10(%ebp)
 
    assert(entry != NULL && head != NULL);
c010710c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107110:	74 06                	je     c0107118 <_fifo_map_swappable+0x24>
c0107112:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107116:	75 24                	jne    c010713c <_fifo_map_swappable+0x48>
c0107118:	c7 44 24 0c f4 b2 10 	movl   $0xc010b2f4,0xc(%esp)
c010711f:	c0 
c0107120:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107127:	c0 
c0107128:	c7 44 24 04 32 00 00 	movl   $0x32,0x4(%esp)
c010712f:	00 
c0107130:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c0107137:	e8 e7 9a ff ff       	call   c0100c23 <__panic>
c010713c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010713f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107142:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107145:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107148:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010714b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c010714e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107151:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0107154:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107157:	8b 40 04             	mov    0x4(%eax),%eax
c010715a:	8b 55 e0             	mov    -0x20(%ebp),%edx
c010715d:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0107160:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107163:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0107166:	89 45 d4             	mov    %eax,-0x2c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0107169:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010716c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010716f:	89 10                	mov    %edx,(%eax)
c0107171:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107174:	8b 10                	mov    (%eax),%edx
c0107176:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0107179:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c010717c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010717f:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107182:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0107185:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107188:	8b 55 d8             	mov    -0x28(%ebp),%edx
c010718b:	89 10                	mov    %edx,(%eax)
    //record the page access situlation
    /*LAB3 EXERCISE 2: YOUR CODE*/ 
    //(1)link the most recent arrival page at the back of the pra_list_head qeueue.
    list_add(head, entry);
    return 0;
c010718d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107192:	c9                   	leave  
c0107193:	c3                   	ret    

c0107194 <_fifo_swap_out_victim>:
 *  (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the  earliest arrival page in front of pra_list_head qeueue,
 *                            then set the addr of addr of this page to ptr_page.
 */
static int
_fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick)
{
c0107194:	55                   	push   %ebp
c0107195:	89 e5                	mov    %esp,%ebp
c0107197:	83 ec 38             	sub    $0x38,%esp
     list_entry_t *head=(list_entry_t*) mm->sm_priv;
c010719a:	8b 45 08             	mov    0x8(%ebp),%eax
c010719d:	8b 40 14             	mov    0x14(%eax),%eax
c01071a0:	89 45 f4             	mov    %eax,-0xc(%ebp)
         assert(head != NULL);
c01071a3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01071a7:	75 24                	jne    c01071cd <_fifo_swap_out_victim+0x39>
c01071a9:	c7 44 24 0c 3b b3 10 	movl   $0xc010b33b,0xc(%esp)
c01071b0:	c0 
c01071b1:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c01071b8:	c0 
c01071b9:	c7 44 24 04 41 00 00 	movl   $0x41,0x4(%esp)
c01071c0:	00 
c01071c1:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01071c8:	e8 56 9a ff ff       	call   c0100c23 <__panic>
     assert(in_tick==0);
c01071cd:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01071d1:	74 24                	je     c01071f7 <_fifo_swap_out_victim+0x63>
c01071d3:	c7 44 24 0c 48 b3 10 	movl   $0xc010b348,0xc(%esp)
c01071da:	c0 
c01071db:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c01071e2:	c0 
c01071e3:	c7 44 24 04 42 00 00 	movl   $0x42,0x4(%esp)
c01071ea:	00 
c01071eb:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01071f2:	e8 2c 9a ff ff       	call   c0100c23 <__panic>
     /* Select the victim */
     /*LAB3 EXERCISE 2: YOUR CODE*/ 
     //(1)  unlink the  earliest arrival page in front of pra_list_head qeueue
     //(2)  set the addr of addr of this page to ptr_page
     /* Select the tail */
     list_entry_t *le = head->prev;
c01071f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01071fa:	8b 00                	mov    (%eax),%eax
c01071fc:	89 45 f0             	mov    %eax,-0x10(%ebp)
     assert(head!=le);
c01071ff:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107202:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0107205:	75 24                	jne    c010722b <_fifo_swap_out_victim+0x97>
c0107207:	c7 44 24 0c 53 b3 10 	movl   $0xc010b353,0xc(%esp)
c010720e:	c0 
c010720f:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107216:	c0 
c0107217:	c7 44 24 04 49 00 00 	movl   $0x49,0x4(%esp)
c010721e:	00 
c010721f:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c0107226:	e8 f8 99 ff ff       	call   c0100c23 <__panic>
     struct Page *p = le2page(le, pra_page_link);
c010722b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010722e:	83 e8 14             	sub    $0x14,%eax
c0107231:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107234:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107237:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c010723a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010723d:	8b 40 04             	mov    0x4(%eax),%eax
c0107240:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0107243:	8b 12                	mov    (%edx),%edx
c0107245:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0107248:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c010724b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010724e:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0107251:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0107254:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107257:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010725a:	89 10                	mov    %edx,(%eax)
     list_del(le);
     assert(p !=NULL);
c010725c:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0107260:	75 24                	jne    c0107286 <_fifo_swap_out_victim+0xf2>
c0107262:	c7 44 24 0c 5c b3 10 	movl   $0xc010b35c,0xc(%esp)
c0107269:	c0 
c010726a:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107271:	c0 
c0107272:	c7 44 24 04 4c 00 00 	movl   $0x4c,0x4(%esp)
c0107279:	00 
c010727a:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c0107281:	e8 9d 99 ff ff       	call   c0100c23 <__panic>
     *ptr_page = p;
c0107286:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107289:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010728c:	89 10                	mov    %edx,(%eax)
     return 0;
c010728e:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107293:	c9                   	leave  
c0107294:	c3                   	ret    

c0107295 <_fifo_check_swap>:

static int
_fifo_check_swap(void) {
c0107295:	55                   	push   %ebp
c0107296:	89 e5                	mov    %esp,%ebp
c0107298:	83 ec 18             	sub    $0x18,%esp
    cprintf("write Virt Page c in fifo_check_swap\n");
c010729b:	c7 04 24 68 b3 10 c0 	movl   $0xc010b368,(%esp)
c01072a2:	e8 ac 90 ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c01072a7:	b8 00 30 00 00       	mov    $0x3000,%eax
c01072ac:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==4);
c01072af:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01072b4:	83 f8 04             	cmp    $0x4,%eax
c01072b7:	74 24                	je     c01072dd <_fifo_check_swap+0x48>
c01072b9:	c7 44 24 0c 8e b3 10 	movl   $0xc010b38e,0xc(%esp)
c01072c0:	c0 
c01072c1:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c01072c8:	c0 
c01072c9:	c7 44 24 04 55 00 00 	movl   $0x55,0x4(%esp)
c01072d0:	00 
c01072d1:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01072d8:	e8 46 99 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c01072dd:	c7 04 24 a0 b3 10 c0 	movl   $0xc010b3a0,(%esp)
c01072e4:	e8 6a 90 ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c01072e9:	b8 00 10 00 00       	mov    $0x1000,%eax
c01072ee:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==4);
c01072f1:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01072f6:	83 f8 04             	cmp    $0x4,%eax
c01072f9:	74 24                	je     c010731f <_fifo_check_swap+0x8a>
c01072fb:	c7 44 24 0c 8e b3 10 	movl   $0xc010b38e,0xc(%esp)
c0107302:	c0 
c0107303:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c010730a:	c0 
c010730b:	c7 44 24 04 58 00 00 	movl   $0x58,0x4(%esp)
c0107312:	00 
c0107313:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c010731a:	e8 04 99 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c010731f:	c7 04 24 c8 b3 10 c0 	movl   $0xc010b3c8,(%esp)
c0107326:	e8 28 90 ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c010732b:	b8 00 40 00 00       	mov    $0x4000,%eax
c0107330:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==4);
c0107333:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0107338:	83 f8 04             	cmp    $0x4,%eax
c010733b:	74 24                	je     c0107361 <_fifo_check_swap+0xcc>
c010733d:	c7 44 24 0c 8e b3 10 	movl   $0xc010b38e,0xc(%esp)
c0107344:	c0 
c0107345:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c010734c:	c0 
c010734d:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c0107354:	00 
c0107355:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c010735c:	e8 c2 98 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0107361:	c7 04 24 f0 b3 10 c0 	movl   $0xc010b3f0,(%esp)
c0107368:	e8 e6 8f ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c010736d:	b8 00 20 00 00       	mov    $0x2000,%eax
c0107372:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==4);
c0107375:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c010737a:	83 f8 04             	cmp    $0x4,%eax
c010737d:	74 24                	je     c01073a3 <_fifo_check_swap+0x10e>
c010737f:	c7 44 24 0c 8e b3 10 	movl   $0xc010b38e,0xc(%esp)
c0107386:	c0 
c0107387:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c010738e:	c0 
c010738f:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0107396:	00 
c0107397:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c010739e:	e8 80 98 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c01073a3:	c7 04 24 18 b4 10 c0 	movl   $0xc010b418,(%esp)
c01073aa:	e8 a4 8f ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c01073af:	b8 00 50 00 00       	mov    $0x5000,%eax
c01073b4:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==5);
c01073b7:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01073bc:	83 f8 05             	cmp    $0x5,%eax
c01073bf:	74 24                	je     c01073e5 <_fifo_check_swap+0x150>
c01073c1:	c7 44 24 0c 3e b4 10 	movl   $0xc010b43e,0xc(%esp)
c01073c8:	c0 
c01073c9:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c01073d0:	c0 
c01073d1:	c7 44 24 04 61 00 00 	movl   $0x61,0x4(%esp)
c01073d8:	00 
c01073d9:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01073e0:	e8 3e 98 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c01073e5:	c7 04 24 f0 b3 10 c0 	movl   $0xc010b3f0,(%esp)
c01073ec:	e8 62 8f ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c01073f1:	b8 00 20 00 00       	mov    $0x2000,%eax
c01073f6:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==5);
c01073f9:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01073fe:	83 f8 05             	cmp    $0x5,%eax
c0107401:	74 24                	je     c0107427 <_fifo_check_swap+0x192>
c0107403:	c7 44 24 0c 3e b4 10 	movl   $0xc010b43e,0xc(%esp)
c010740a:	c0 
c010740b:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107412:	c0 
c0107413:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c010741a:	00 
c010741b:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c0107422:	e8 fc 97 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0107427:	c7 04 24 a0 b3 10 c0 	movl   $0xc010b3a0,(%esp)
c010742e:	e8 20 8f ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c0107433:	b8 00 10 00 00       	mov    $0x1000,%eax
c0107438:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==6);
c010743b:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0107440:	83 f8 06             	cmp    $0x6,%eax
c0107443:	74 24                	je     c0107469 <_fifo_check_swap+0x1d4>
c0107445:	c7 44 24 0c 4d b4 10 	movl   $0xc010b44d,0xc(%esp)
c010744c:	c0 
c010744d:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107454:	c0 
c0107455:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c010745c:	00 
c010745d:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c0107464:	e8 ba 97 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0107469:	c7 04 24 f0 b3 10 c0 	movl   $0xc010b3f0,(%esp)
c0107470:	e8 de 8e ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0107475:	b8 00 20 00 00       	mov    $0x2000,%eax
c010747a:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==7);
c010747d:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0107482:	83 f8 07             	cmp    $0x7,%eax
c0107485:	74 24                	je     c01074ab <_fifo_check_swap+0x216>
c0107487:	c7 44 24 0c 5c b4 10 	movl   $0xc010b45c,0xc(%esp)
c010748e:	c0 
c010748f:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c0107496:	c0 
c0107497:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c010749e:	00 
c010749f:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01074a6:	e8 78 97 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page c in fifo_check_swap\n");
c01074ab:	c7 04 24 68 b3 10 c0 	movl   $0xc010b368,(%esp)
c01074b2:	e8 9c 8e ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c01074b7:	b8 00 30 00 00       	mov    $0x3000,%eax
c01074bc:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==8);
c01074bf:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01074c4:	83 f8 08             	cmp    $0x8,%eax
c01074c7:	74 24                	je     c01074ed <_fifo_check_swap+0x258>
c01074c9:	c7 44 24 0c 6b b4 10 	movl   $0xc010b46b,0xc(%esp)
c01074d0:	c0 
c01074d1:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c01074d8:	c0 
c01074d9:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c01074e0:	00 
c01074e1:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c01074e8:	e8 36 97 ff ff       	call   c0100c23 <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c01074ed:	c7 04 24 c8 b3 10 c0 	movl   $0xc010b3c8,(%esp)
c01074f4:	e8 5a 8e ff ff       	call   c0100353 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c01074f9:	b8 00 40 00 00       	mov    $0x4000,%eax
c01074fe:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==9);
c0107501:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c0107506:	83 f8 09             	cmp    $0x9,%eax
c0107509:	74 24                	je     c010752f <_fifo_check_swap+0x29a>
c010750b:	c7 44 24 0c 7a b4 10 	movl   $0xc010b47a,0xc(%esp)
c0107512:	c0 
c0107513:	c7 44 24 08 12 b3 10 	movl   $0xc010b312,0x8(%esp)
c010751a:	c0 
c010751b:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c0107522:	00 
c0107523:	c7 04 24 27 b3 10 c0 	movl   $0xc010b327,(%esp)
c010752a:	e8 f4 96 ff ff       	call   c0100c23 <__panic>
    return 0;
c010752f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107534:	c9                   	leave  
c0107535:	c3                   	ret    

c0107536 <_fifo_init>:


static int
_fifo_init(void)
{
c0107536:	55                   	push   %ebp
c0107537:	89 e5                	mov    %esp,%ebp
    return 0;
c0107539:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010753e:	5d                   	pop    %ebp
c010753f:	c3                   	ret    

c0107540 <_fifo_set_unswappable>:

static int
_fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0107540:	55                   	push   %ebp
c0107541:	89 e5                	mov    %esp,%ebp
    return 0;
c0107543:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107548:	5d                   	pop    %ebp
c0107549:	c3                   	ret    

c010754a <_fifo_tick_event>:

static int
_fifo_tick_event(struct mm_struct *mm)
{ return 0; }
c010754a:	55                   	push   %ebp
c010754b:	89 e5                	mov    %esp,%ebp
c010754d:	b8 00 00 00 00       	mov    $0x0,%eax
c0107552:	5d                   	pop    %ebp
c0107553:	c3                   	ret    

c0107554 <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c0107554:	55                   	push   %ebp
c0107555:	89 e5                	mov    %esp,%ebp
c0107557:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c010755a:	8b 45 08             	mov    0x8(%ebp),%eax
c010755d:	c1 e8 0c             	shr    $0xc,%eax
c0107560:	89 c2                	mov    %eax,%edx
c0107562:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c0107567:	39 c2                	cmp    %eax,%edx
c0107569:	72 1c                	jb     c0107587 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c010756b:	c7 44 24 08 9c b4 10 	movl   $0xc010b49c,0x8(%esp)
c0107572:	c0 
c0107573:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c010757a:	00 
c010757b:	c7 04 24 bb b4 10 c0 	movl   $0xc010b4bb,(%esp)
c0107582:	e8 9c 96 ff ff       	call   c0100c23 <__panic>
    }
    return &pages[PPN(pa)];
c0107587:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c010758c:	8b 55 08             	mov    0x8(%ebp),%edx
c010758f:	c1 ea 0c             	shr    $0xc,%edx
c0107592:	c1 e2 05             	shl    $0x5,%edx
c0107595:	01 d0                	add    %edx,%eax
}
c0107597:	c9                   	leave  
c0107598:	c3                   	ret    

c0107599 <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c0107599:	55                   	push   %ebp
c010759a:	89 e5                	mov    %esp,%ebp
c010759c:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c010759f:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c01075a6:	e8 6d d2 ff ff       	call   c0104818 <kmalloc>
c01075ab:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (mm != NULL) {
c01075ae:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01075b2:	74 58                	je     c010760c <mm_create+0x73>
        list_init(&(mm->mmap_list));
c01075b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075b7:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01075ba:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01075bd:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01075c0:	89 50 04             	mov    %edx,0x4(%eax)
c01075c3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01075c6:	8b 50 04             	mov    0x4(%eax),%edx
c01075c9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01075cc:	89 10                	mov    %edx,(%eax)
        mm->mmap_cache = NULL;
c01075ce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075d1:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->pgdir = NULL;
c01075d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075db:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->map_count = 0;
c01075e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075e5:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)

        if (swap_init_ok) swap_init_mm(mm);
c01075ec:	a1 cc 5a 12 c0       	mov    0xc0125acc,%eax
c01075f1:	85 c0                	test   %eax,%eax
c01075f3:	74 0d                	je     c0107602 <mm_create+0x69>
c01075f5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075f8:	89 04 24             	mov    %eax,(%esp)
c01075fb:	e8 bf ef ff ff       	call   c01065bf <swap_init_mm>
c0107600:	eb 0a                	jmp    c010760c <mm_create+0x73>
        else mm->sm_priv = NULL;
c0107602:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107605:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
    }
    return mm;
c010760c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010760f:	c9                   	leave  
c0107610:	c3                   	ret    

c0107611 <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c0107611:	55                   	push   %ebp
c0107612:	89 e5                	mov    %esp,%ebp
c0107614:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c0107617:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c010761e:	e8 f5 d1 ff ff       	call   c0104818 <kmalloc>
c0107623:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (vma != NULL) {
c0107626:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010762a:	74 1b                	je     c0107647 <vma_create+0x36>
        vma->vm_start = vm_start;
c010762c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010762f:	8b 55 08             	mov    0x8(%ebp),%edx
c0107632:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c0107635:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107638:	8b 55 0c             	mov    0xc(%ebp),%edx
c010763b:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c010763e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107641:	8b 55 10             	mov    0x10(%ebp),%edx
c0107644:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c0107647:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010764a:	c9                   	leave  
c010764b:	c3                   	ret    

c010764c <find_vma>:


// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c010764c:	55                   	push   %ebp
c010764d:	89 e5                	mov    %esp,%ebp
c010764f:	83 ec 20             	sub    $0x20,%esp
    struct vma_struct *vma = NULL;
c0107652:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    if (mm != NULL) {
c0107659:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010765d:	0f 84 95 00 00 00    	je     c01076f8 <find_vma+0xac>
        vma = mm->mmap_cache;
c0107663:	8b 45 08             	mov    0x8(%ebp),%eax
c0107666:	8b 40 08             	mov    0x8(%eax),%eax
c0107669:	89 45 fc             	mov    %eax,-0x4(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c010766c:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0107670:	74 16                	je     c0107688 <find_vma+0x3c>
c0107672:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0107675:	8b 40 04             	mov    0x4(%eax),%eax
c0107678:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010767b:	77 0b                	ja     c0107688 <find_vma+0x3c>
c010767d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0107680:	8b 40 08             	mov    0x8(%eax),%eax
c0107683:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107686:	77 61                	ja     c01076e9 <find_vma+0x9d>
                bool found = 0;
c0107688:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c010768f:	8b 45 08             	mov    0x8(%ebp),%eax
c0107692:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107695:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107698:	89 45 f4             	mov    %eax,-0xc(%ebp)
                while ((le = list_next(le)) != list) {
c010769b:	eb 28                	jmp    c01076c5 <find_vma+0x79>
                    vma = le2vma(le, list_link);
c010769d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076a0:	83 e8 10             	sub    $0x10,%eax
c01076a3:	89 45 fc             	mov    %eax,-0x4(%ebp)
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
c01076a6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01076a9:	8b 40 04             	mov    0x4(%eax),%eax
c01076ac:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01076af:	77 14                	ja     c01076c5 <find_vma+0x79>
c01076b1:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01076b4:	8b 40 08             	mov    0x8(%eax),%eax
c01076b7:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01076ba:	76 09                	jbe    c01076c5 <find_vma+0x79>
                        found = 1;
c01076bc:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
                        break;
c01076c3:	eb 17                	jmp    c01076dc <find_vma+0x90>
c01076c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076c8:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01076cb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01076ce:	8b 40 04             	mov    0x4(%eax),%eax
    if (mm != NULL) {
        vma = mm->mmap_cache;
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
                bool found = 0;
                list_entry_t *list = &(mm->mmap_list), *le = list;
                while ((le = list_next(le)) != list) {
c01076d1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01076d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076d7:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01076da:	75 c1                	jne    c010769d <find_vma+0x51>
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
                        found = 1;
                        break;
                    }
                }
                if (!found) {
c01076dc:	83 7d f8 00          	cmpl   $0x0,-0x8(%ebp)
c01076e0:	75 07                	jne    c01076e9 <find_vma+0x9d>
                    vma = NULL;
c01076e2:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
                }
        }
        if (vma != NULL) {
c01076e9:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01076ed:	74 09                	je     c01076f8 <find_vma+0xac>
            mm->mmap_cache = vma;
c01076ef:	8b 45 08             	mov    0x8(%ebp),%eax
c01076f2:	8b 55 fc             	mov    -0x4(%ebp),%edx
c01076f5:	89 50 08             	mov    %edx,0x8(%eax)
        }
    }
    return vma;
c01076f8:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c01076fb:	c9                   	leave  
c01076fc:	c3                   	ret    

c01076fd <check_vma_overlap>:


// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c01076fd:	55                   	push   %ebp
c01076fe:	89 e5                	mov    %esp,%ebp
c0107700:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c0107703:	8b 45 08             	mov    0x8(%ebp),%eax
c0107706:	8b 50 04             	mov    0x4(%eax),%edx
c0107709:	8b 45 08             	mov    0x8(%ebp),%eax
c010770c:	8b 40 08             	mov    0x8(%eax),%eax
c010770f:	39 c2                	cmp    %eax,%edx
c0107711:	72 24                	jb     c0107737 <check_vma_overlap+0x3a>
c0107713:	c7 44 24 0c c9 b4 10 	movl   $0xc010b4c9,0xc(%esp)
c010771a:	c0 
c010771b:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107722:	c0 
c0107723:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
c010772a:	00 
c010772b:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107732:	e8 ec 94 ff ff       	call   c0100c23 <__panic>
    assert(prev->vm_end <= next->vm_start);
c0107737:	8b 45 08             	mov    0x8(%ebp),%eax
c010773a:	8b 50 08             	mov    0x8(%eax),%edx
c010773d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107740:	8b 40 04             	mov    0x4(%eax),%eax
c0107743:	39 c2                	cmp    %eax,%edx
c0107745:	76 24                	jbe    c010776b <check_vma_overlap+0x6e>
c0107747:	c7 44 24 0c 0c b5 10 	movl   $0xc010b50c,0xc(%esp)
c010774e:	c0 
c010774f:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107756:	c0 
c0107757:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c010775e:	00 
c010775f:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107766:	e8 b8 94 ff ff       	call   c0100c23 <__panic>
    assert(next->vm_start < next->vm_end);
c010776b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010776e:	8b 50 04             	mov    0x4(%eax),%edx
c0107771:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107774:	8b 40 08             	mov    0x8(%eax),%eax
c0107777:	39 c2                	cmp    %eax,%edx
c0107779:	72 24                	jb     c010779f <check_vma_overlap+0xa2>
c010777b:	c7 44 24 0c 2b b5 10 	movl   $0xc010b52b,0xc(%esp)
c0107782:	c0 
c0107783:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c010778a:	c0 
c010778b:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c0107792:	00 
c0107793:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c010779a:	e8 84 94 ff ff       	call   c0100c23 <__panic>
}
c010779f:	c9                   	leave  
c01077a0:	c3                   	ret    

c01077a1 <insert_vma_struct>:


// insert_vma_struct -insert vma in mm's list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c01077a1:	55                   	push   %ebp
c01077a2:	89 e5                	mov    %esp,%ebp
c01077a4:	83 ec 48             	sub    $0x48,%esp
    assert(vma->vm_start < vma->vm_end);
c01077a7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01077aa:	8b 50 04             	mov    0x4(%eax),%edx
c01077ad:	8b 45 0c             	mov    0xc(%ebp),%eax
c01077b0:	8b 40 08             	mov    0x8(%eax),%eax
c01077b3:	39 c2                	cmp    %eax,%edx
c01077b5:	72 24                	jb     c01077db <insert_vma_struct+0x3a>
c01077b7:	c7 44 24 0c 49 b5 10 	movl   $0xc010b549,0xc(%esp)
c01077be:	c0 
c01077bf:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c01077c6:	c0 
c01077c7:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c01077ce:	00 
c01077cf:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c01077d6:	e8 48 94 ff ff       	call   c0100c23 <__panic>
    list_entry_t *list = &(mm->mmap_list);
c01077db:	8b 45 08             	mov    0x8(%ebp),%eax
c01077de:	89 45 ec             	mov    %eax,-0x14(%ebp)
    list_entry_t *le_prev = list, *le_next;
c01077e1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01077e4:	89 45 f4             	mov    %eax,-0xc(%ebp)

        list_entry_t *le = list;
c01077e7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01077ea:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while ((le = list_next(le)) != list) {
c01077ed:	eb 21                	jmp    c0107810 <insert_vma_struct+0x6f>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c01077ef:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01077f2:	83 e8 10             	sub    $0x10,%eax
c01077f5:	89 45 e8             	mov    %eax,-0x18(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c01077f8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01077fb:	8b 50 04             	mov    0x4(%eax),%edx
c01077fe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107801:	8b 40 04             	mov    0x4(%eax),%eax
c0107804:	39 c2                	cmp    %eax,%edx
c0107806:	76 02                	jbe    c010780a <insert_vma_struct+0x69>
                break;
c0107808:	eb 1d                	jmp    c0107827 <insert_vma_struct+0x86>
            }
            le_prev = le;
c010780a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010780d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107810:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107813:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0107816:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107819:	8b 40 04             	mov    0x4(%eax),%eax
    assert(vma->vm_start < vma->vm_end);
    list_entry_t *list = &(mm->mmap_list);
    list_entry_t *le_prev = list, *le_next;

        list_entry_t *le = list;
        while ((le = list_next(le)) != list) {
c010781c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010781f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107822:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107825:	75 c8                	jne    c01077ef <insert_vma_struct+0x4e>
c0107827:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010782a:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010782d:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107830:	8b 40 04             	mov    0x4(%eax),%eax
                break;
            }
            le_prev = le;
        }

    le_next = list_next(le_prev);
c0107833:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c0107836:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107839:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010783c:	74 15                	je     c0107853 <insert_vma_struct+0xb2>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c010783e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107841:	8d 50 f0             	lea    -0x10(%eax),%edx
c0107844:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107847:	89 44 24 04          	mov    %eax,0x4(%esp)
c010784b:	89 14 24             	mov    %edx,(%esp)
c010784e:	e8 aa fe ff ff       	call   c01076fd <check_vma_overlap>
    }
    if (le_next != list) {
c0107853:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107856:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107859:	74 15                	je     c0107870 <insert_vma_struct+0xcf>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c010785b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010785e:	83 e8 10             	sub    $0x10,%eax
c0107861:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107865:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107868:	89 04 24             	mov    %eax,(%esp)
c010786b:	e8 8d fe ff ff       	call   c01076fd <check_vma_overlap>
    }

    vma->vm_mm = mm;
c0107870:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107873:	8b 55 08             	mov    0x8(%ebp),%edx
c0107876:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c0107878:	8b 45 0c             	mov    0xc(%ebp),%eax
c010787b:	8d 50 10             	lea    0x10(%eax),%edx
c010787e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107881:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0107884:	89 55 d4             	mov    %edx,-0x2c(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0107887:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010788a:	8b 40 04             	mov    0x4(%eax),%eax
c010788d:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107890:	89 55 d0             	mov    %edx,-0x30(%ebp)
c0107893:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0107896:	89 55 cc             	mov    %edx,-0x34(%ebp)
c0107899:	89 45 c8             	mov    %eax,-0x38(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c010789c:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010789f:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01078a2:	89 10                	mov    %edx,(%eax)
c01078a4:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01078a7:	8b 10                	mov    (%eax),%edx
c01078a9:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01078ac:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01078af:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01078b2:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01078b5:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01078b8:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01078bb:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01078be:	89 10                	mov    %edx,(%eax)

    mm->map_count ++;
c01078c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01078c3:	8b 40 10             	mov    0x10(%eax),%eax
c01078c6:	8d 50 01             	lea    0x1(%eax),%edx
c01078c9:	8b 45 08             	mov    0x8(%ebp),%eax
c01078cc:	89 50 10             	mov    %edx,0x10(%eax)
}
c01078cf:	c9                   	leave  
c01078d0:	c3                   	ret    

c01078d1 <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c01078d1:	55                   	push   %ebp
c01078d2:	89 e5                	mov    %esp,%ebp
c01078d4:	83 ec 38             	sub    $0x38,%esp

    list_entry_t *list = &(mm->mmap_list), *le;
c01078d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01078da:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(list)) != list) {
c01078dd:	eb 36                	jmp    c0107915 <mm_destroy+0x44>
c01078df:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01078e2:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * Note: list_empty() on @listelm does not return true after this, the entry is
 * in an undefined state.
 * */
static inline void
list_del(list_entry_t *listelm) {
    __list_del(listelm->prev, listelm->next);
c01078e5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01078e8:	8b 40 04             	mov    0x4(%eax),%eax
c01078eb:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01078ee:	8b 12                	mov    (%edx),%edx
c01078f0:	89 55 e8             	mov    %edx,-0x18(%ebp)
c01078f3:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c01078f6:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01078f9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01078fc:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c01078ff:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107902:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0107905:	89 10                	mov    %edx,(%eax)
        list_del(le);
        kfree(le2vma(le, list_link));  //kfree vma        
c0107907:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010790a:	83 e8 10             	sub    $0x10,%eax
c010790d:	89 04 24             	mov    %eax,(%esp)
c0107910:	e8 1e cf ff ff       	call   c0104833 <kfree>
c0107915:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107918:	89 45 e0             	mov    %eax,-0x20(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010791b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010791e:	8b 40 04             	mov    0x4(%eax),%eax
// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {

    list_entry_t *list = &(mm->mmap_list), *le;
    while ((le = list_next(list)) != list) {
c0107921:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107924:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107927:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010792a:	75 b3                	jne    c01078df <mm_destroy+0xe>
        list_del(le);
        kfree(le2vma(le, list_link));  //kfree vma        
    }
    kfree(mm); //kfree mm
c010792c:	8b 45 08             	mov    0x8(%ebp),%eax
c010792f:	89 04 24             	mov    %eax,(%esp)
c0107932:	e8 fc ce ff ff       	call   c0104833 <kfree>
    mm=NULL;
c0107937:	c7 45 08 00 00 00 00 	movl   $0x0,0x8(%ebp)
}
c010793e:	c9                   	leave  
c010793f:	c3                   	ret    

c0107940 <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c0107940:	55                   	push   %ebp
c0107941:	89 e5                	mov    %esp,%ebp
c0107943:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c0107946:	e8 02 00 00 00       	call   c010794d <check_vmm>
}
c010794b:	c9                   	leave  
c010794c:	c3                   	ret    

c010794d <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c010794d:	55                   	push   %ebp
c010794e:	89 e5                	mov    %esp,%ebp
c0107950:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0107953:	e8 ba d3 ff ff       	call   c0104d12 <nr_free_pages>
c0107958:	89 45 f4             	mov    %eax,-0xc(%ebp)
    
    check_vma_struct();
c010795b:	e8 41 00 00 00       	call   c01079a1 <check_vma_struct>
    check_pgfault();
c0107960:	e8 03 05 00 00       	call   c0107e68 <check_pgfault>

    assert(nr_free_pages_store == nr_free_pages());
c0107965:	e8 a8 d3 ff ff       	call   c0104d12 <nr_free_pages>
c010796a:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010796d:	74 24                	je     c0107993 <check_vmm+0x46>
c010796f:	c7 44 24 0c 68 b5 10 	movl   $0xc010b568,0xc(%esp)
c0107976:	c0 
c0107977:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c010797e:	c0 
c010797f:	c7 44 24 04 aa 00 00 	movl   $0xaa,0x4(%esp)
c0107986:	00 
c0107987:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c010798e:	e8 90 92 ff ff       	call   c0100c23 <__panic>

    cprintf("check_vmm() succeeded.\n");
c0107993:	c7 04 24 8f b5 10 c0 	movl   $0xc010b58f,(%esp)
c010799a:	e8 b4 89 ff ff       	call   c0100353 <cprintf>
}
c010799f:	c9                   	leave  
c01079a0:	c3                   	ret    

c01079a1 <check_vma_struct>:

static void
check_vma_struct(void) {
c01079a1:	55                   	push   %ebp
c01079a2:	89 e5                	mov    %esp,%ebp
c01079a4:	83 ec 68             	sub    $0x68,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01079a7:	e8 66 d3 ff ff       	call   c0104d12 <nr_free_pages>
c01079ac:	89 45 ec             	mov    %eax,-0x14(%ebp)

    struct mm_struct *mm = mm_create();
c01079af:	e8 e5 fb ff ff       	call   c0107599 <mm_create>
c01079b4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(mm != NULL);
c01079b7:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01079bb:	75 24                	jne    c01079e1 <check_vma_struct+0x40>
c01079bd:	c7 44 24 0c a7 b5 10 	movl   $0xc010b5a7,0xc(%esp)
c01079c4:	c0 
c01079c5:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c01079cc:	c0 
c01079cd:	c7 44 24 04 b4 00 00 	movl   $0xb4,0x4(%esp)
c01079d4:	00 
c01079d5:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c01079dc:	e8 42 92 ff ff       	call   c0100c23 <__panic>

    int step1 = 10, step2 = step1 * 10;
c01079e1:	c7 45 e4 0a 00 00 00 	movl   $0xa,-0x1c(%ebp)
c01079e8:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01079eb:	89 d0                	mov    %edx,%eax
c01079ed:	c1 e0 02             	shl    $0x2,%eax
c01079f0:	01 d0                	add    %edx,%eax
c01079f2:	01 c0                	add    %eax,%eax
c01079f4:	89 45 e0             	mov    %eax,-0x20(%ebp)

    int i;
    for (i = step1; i >= 1; i --) {
c01079f7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01079fa:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01079fd:	eb 70                	jmp    c0107a6f <check_vma_struct+0xce>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c01079ff:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107a02:	89 d0                	mov    %edx,%eax
c0107a04:	c1 e0 02             	shl    $0x2,%eax
c0107a07:	01 d0                	add    %edx,%eax
c0107a09:	83 c0 02             	add    $0x2,%eax
c0107a0c:	89 c1                	mov    %eax,%ecx
c0107a0e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107a11:	89 d0                	mov    %edx,%eax
c0107a13:	c1 e0 02             	shl    $0x2,%eax
c0107a16:	01 d0                	add    %edx,%eax
c0107a18:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107a1f:	00 
c0107a20:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0107a24:	89 04 24             	mov    %eax,(%esp)
c0107a27:	e8 e5 fb ff ff       	call   c0107611 <vma_create>
c0107a2c:	89 45 dc             	mov    %eax,-0x24(%ebp)
        assert(vma != NULL);
c0107a2f:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0107a33:	75 24                	jne    c0107a59 <check_vma_struct+0xb8>
c0107a35:	c7 44 24 0c b2 b5 10 	movl   $0xc010b5b2,0xc(%esp)
c0107a3c:	c0 
c0107a3d:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107a44:	c0 
c0107a45:	c7 44 24 04 bb 00 00 	movl   $0xbb,0x4(%esp)
c0107a4c:	00 
c0107a4d:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107a54:	e8 ca 91 ff ff       	call   c0100c23 <__panic>
        insert_vma_struct(mm, vma);
c0107a59:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107a5c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107a60:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107a63:	89 04 24             	mov    %eax,(%esp)
c0107a66:	e8 36 fd ff ff       	call   c01077a1 <insert_vma_struct>
    assert(mm != NULL);

    int step1 = 10, step2 = step1 * 10;

    int i;
    for (i = step1; i >= 1; i --) {
c0107a6b:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c0107a6f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107a73:	7f 8a                	jg     c01079ff <check_vma_struct+0x5e>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0107a75:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107a78:	83 c0 01             	add    $0x1,%eax
c0107a7b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0107a7e:	eb 70                	jmp    c0107af0 <check_vma_struct+0x14f>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0107a80:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107a83:	89 d0                	mov    %edx,%eax
c0107a85:	c1 e0 02             	shl    $0x2,%eax
c0107a88:	01 d0                	add    %edx,%eax
c0107a8a:	83 c0 02             	add    $0x2,%eax
c0107a8d:	89 c1                	mov    %eax,%ecx
c0107a8f:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107a92:	89 d0                	mov    %edx,%eax
c0107a94:	c1 e0 02             	shl    $0x2,%eax
c0107a97:	01 d0                	add    %edx,%eax
c0107a99:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107aa0:	00 
c0107aa1:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0107aa5:	89 04 24             	mov    %eax,(%esp)
c0107aa8:	e8 64 fb ff ff       	call   c0107611 <vma_create>
c0107aad:	89 45 d8             	mov    %eax,-0x28(%ebp)
        assert(vma != NULL);
c0107ab0:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0107ab4:	75 24                	jne    c0107ada <check_vma_struct+0x139>
c0107ab6:	c7 44 24 0c b2 b5 10 	movl   $0xc010b5b2,0xc(%esp)
c0107abd:	c0 
c0107abe:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107ac5:	c0 
c0107ac6:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c0107acd:	00 
c0107ace:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107ad5:	e8 49 91 ff ff       	call   c0100c23 <__panic>
        insert_vma_struct(mm, vma);
c0107ada:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0107add:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107ae1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ae4:	89 04 24             	mov    %eax,(%esp)
c0107ae7:	e8 b5 fc ff ff       	call   c01077a1 <insert_vma_struct>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0107aec:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107af0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107af3:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0107af6:	7e 88                	jle    c0107a80 <check_vma_struct+0xdf>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
        assert(vma != NULL);
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c0107af8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107afb:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0107afe:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0107b01:	8b 40 04             	mov    0x4(%eax),%eax
c0107b04:	89 45 f0             	mov    %eax,-0x10(%ebp)

    for (i = 1; i <= step2; i ++) {
c0107b07:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c0107b0e:	e9 97 00 00 00       	jmp    c0107baa <check_vma_struct+0x209>
        assert(le != &(mm->mmap_list));
c0107b13:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107b16:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0107b19:	75 24                	jne    c0107b3f <check_vma_struct+0x19e>
c0107b1b:	c7 44 24 0c be b5 10 	movl   $0xc010b5be,0xc(%esp)
c0107b22:	c0 
c0107b23:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107b2a:	c0 
c0107b2b:	c7 44 24 04 c8 00 00 	movl   $0xc8,0x4(%esp)
c0107b32:	00 
c0107b33:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107b3a:	e8 e4 90 ff ff       	call   c0100c23 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c0107b3f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b42:	83 e8 10             	sub    $0x10,%eax
c0107b45:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c0107b48:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107b4b:	8b 48 04             	mov    0x4(%eax),%ecx
c0107b4e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107b51:	89 d0                	mov    %edx,%eax
c0107b53:	c1 e0 02             	shl    $0x2,%eax
c0107b56:	01 d0                	add    %edx,%eax
c0107b58:	39 c1                	cmp    %eax,%ecx
c0107b5a:	75 17                	jne    c0107b73 <check_vma_struct+0x1d2>
c0107b5c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0107b5f:	8b 48 08             	mov    0x8(%eax),%ecx
c0107b62:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107b65:	89 d0                	mov    %edx,%eax
c0107b67:	c1 e0 02             	shl    $0x2,%eax
c0107b6a:	01 d0                	add    %edx,%eax
c0107b6c:	83 c0 02             	add    $0x2,%eax
c0107b6f:	39 c1                	cmp    %eax,%ecx
c0107b71:	74 24                	je     c0107b97 <check_vma_struct+0x1f6>
c0107b73:	c7 44 24 0c d8 b5 10 	movl   $0xc010b5d8,0xc(%esp)
c0107b7a:	c0 
c0107b7b:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107b82:	c0 
c0107b83:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0107b8a:	00 
c0107b8b:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107b92:	e8 8c 90 ff ff       	call   c0100c23 <__panic>
c0107b97:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107b9a:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c0107b9d:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107ba0:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c0107ba3:	89 45 f0             	mov    %eax,-0x10(%ebp)
        insert_vma_struct(mm, vma);
    }

    list_entry_t *le = list_next(&(mm->mmap_list));

    for (i = 1; i <= step2; i ++) {
c0107ba6:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107baa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107bad:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0107bb0:	0f 8e 5d ff ff ff    	jle    c0107b13 <check_vma_struct+0x172>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c0107bb6:	c7 45 f4 05 00 00 00 	movl   $0x5,-0xc(%ebp)
c0107bbd:	e9 cd 01 00 00       	jmp    c0107d8f <check_vma_struct+0x3ee>
        struct vma_struct *vma1 = find_vma(mm, i);
c0107bc2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107bc5:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107bc9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107bcc:	89 04 24             	mov    %eax,(%esp)
c0107bcf:	e8 78 fa ff ff       	call   c010764c <find_vma>
c0107bd4:	89 45 d0             	mov    %eax,-0x30(%ebp)
        assert(vma1 != NULL);
c0107bd7:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0107bdb:	75 24                	jne    c0107c01 <check_vma_struct+0x260>
c0107bdd:	c7 44 24 0c 0d b6 10 	movl   $0xc010b60d,0xc(%esp)
c0107be4:	c0 
c0107be5:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107bec:	c0 
c0107bed:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c0107bf4:	00 
c0107bf5:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107bfc:	e8 22 90 ff ff       	call   c0100c23 <__panic>
        struct vma_struct *vma2 = find_vma(mm, i+1);
c0107c01:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c04:	83 c0 01             	add    $0x1,%eax
c0107c07:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c0b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107c0e:	89 04 24             	mov    %eax,(%esp)
c0107c11:	e8 36 fa ff ff       	call   c010764c <find_vma>
c0107c16:	89 45 cc             	mov    %eax,-0x34(%ebp)
        assert(vma2 != NULL);
c0107c19:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c0107c1d:	75 24                	jne    c0107c43 <check_vma_struct+0x2a2>
c0107c1f:	c7 44 24 0c 1a b6 10 	movl   $0xc010b61a,0xc(%esp)
c0107c26:	c0 
c0107c27:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107c2e:	c0 
c0107c2f:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0107c36:	00 
c0107c37:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107c3e:	e8 e0 8f ff ff       	call   c0100c23 <__panic>
        struct vma_struct *vma3 = find_vma(mm, i+2);
c0107c43:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c46:	83 c0 02             	add    $0x2,%eax
c0107c49:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c4d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107c50:	89 04 24             	mov    %eax,(%esp)
c0107c53:	e8 f4 f9 ff ff       	call   c010764c <find_vma>
c0107c58:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(vma3 == NULL);
c0107c5b:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c0107c5f:	74 24                	je     c0107c85 <check_vma_struct+0x2e4>
c0107c61:	c7 44 24 0c 27 b6 10 	movl   $0xc010b627,0xc(%esp)
c0107c68:	c0 
c0107c69:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107c70:	c0 
c0107c71:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c0107c78:	00 
c0107c79:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107c80:	e8 9e 8f ff ff       	call   c0100c23 <__panic>
        struct vma_struct *vma4 = find_vma(mm, i+3);
c0107c85:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107c88:	83 c0 03             	add    $0x3,%eax
c0107c8b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107c8f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107c92:	89 04 24             	mov    %eax,(%esp)
c0107c95:	e8 b2 f9 ff ff       	call   c010764c <find_vma>
c0107c9a:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        assert(vma4 == NULL);
c0107c9d:	83 7d c4 00          	cmpl   $0x0,-0x3c(%ebp)
c0107ca1:	74 24                	je     c0107cc7 <check_vma_struct+0x326>
c0107ca3:	c7 44 24 0c 34 b6 10 	movl   $0xc010b634,0xc(%esp)
c0107caa:	c0 
c0107cab:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107cb2:	c0 
c0107cb3:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c0107cba:	00 
c0107cbb:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107cc2:	e8 5c 8f ff ff       	call   c0100c23 <__panic>
        struct vma_struct *vma5 = find_vma(mm, i+4);
c0107cc7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107cca:	83 c0 04             	add    $0x4,%eax
c0107ccd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107cd1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107cd4:	89 04 24             	mov    %eax,(%esp)
c0107cd7:	e8 70 f9 ff ff       	call   c010764c <find_vma>
c0107cdc:	89 45 c0             	mov    %eax,-0x40(%ebp)
        assert(vma5 == NULL);
c0107cdf:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c0107ce3:	74 24                	je     c0107d09 <check_vma_struct+0x368>
c0107ce5:	c7 44 24 0c 41 b6 10 	movl   $0xc010b641,0xc(%esp)
c0107cec:	c0 
c0107ced:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107cf4:	c0 
c0107cf5:	c7 44 24 04 d8 00 00 	movl   $0xd8,0x4(%esp)
c0107cfc:	00 
c0107cfd:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107d04:	e8 1a 8f ff ff       	call   c0100c23 <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
c0107d09:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107d0c:	8b 50 04             	mov    0x4(%eax),%edx
c0107d0f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d12:	39 c2                	cmp    %eax,%edx
c0107d14:	75 10                	jne    c0107d26 <check_vma_struct+0x385>
c0107d16:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107d19:	8b 50 08             	mov    0x8(%eax),%edx
c0107d1c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d1f:	83 c0 02             	add    $0x2,%eax
c0107d22:	39 c2                	cmp    %eax,%edx
c0107d24:	74 24                	je     c0107d4a <check_vma_struct+0x3a9>
c0107d26:	c7 44 24 0c 50 b6 10 	movl   $0xc010b650,0xc(%esp)
c0107d2d:	c0 
c0107d2e:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107d35:	c0 
c0107d36:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c0107d3d:	00 
c0107d3e:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107d45:	e8 d9 8e ff ff       	call   c0100c23 <__panic>
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
c0107d4a:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107d4d:	8b 50 04             	mov    0x4(%eax),%edx
c0107d50:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d53:	39 c2                	cmp    %eax,%edx
c0107d55:	75 10                	jne    c0107d67 <check_vma_struct+0x3c6>
c0107d57:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0107d5a:	8b 50 08             	mov    0x8(%eax),%edx
c0107d5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d60:	83 c0 02             	add    $0x2,%eax
c0107d63:	39 c2                	cmp    %eax,%edx
c0107d65:	74 24                	je     c0107d8b <check_vma_struct+0x3ea>
c0107d67:	c7 44 24 0c 80 b6 10 	movl   $0xc010b680,0xc(%esp)
c0107d6e:	c0 
c0107d6f:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107d76:	c0 
c0107d77:	c7 44 24 04 db 00 00 	movl   $0xdb,0x4(%esp)
c0107d7e:	00 
c0107d7f:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107d86:	e8 98 8e ff ff       	call   c0100c23 <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
        le = list_next(le);
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c0107d8b:	83 45 f4 05          	addl   $0x5,-0xc(%ebp)
c0107d8f:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0107d92:	89 d0                	mov    %edx,%eax
c0107d94:	c1 e0 02             	shl    $0x2,%eax
c0107d97:	01 d0                	add    %edx,%eax
c0107d99:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0107d9c:	0f 8d 20 fe ff ff    	jge    c0107bc2 <check_vma_struct+0x221>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
    }

    for (i =4; i>=0; i--) {
c0107da2:	c7 45 f4 04 00 00 00 	movl   $0x4,-0xc(%ebp)
c0107da9:	eb 70                	jmp    c0107e1b <check_vma_struct+0x47a>
        struct vma_struct *vma_below_5= find_vma(mm,i);
c0107dab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107dae:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107db2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107db5:	89 04 24             	mov    %eax,(%esp)
c0107db8:	e8 8f f8 ff ff       	call   c010764c <find_vma>
c0107dbd:	89 45 bc             	mov    %eax,-0x44(%ebp)
        if (vma_below_5 != NULL ) {
c0107dc0:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0107dc4:	74 27                	je     c0107ded <check_vma_struct+0x44c>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
c0107dc6:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107dc9:	8b 50 08             	mov    0x8(%eax),%edx
c0107dcc:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107dcf:	8b 40 04             	mov    0x4(%eax),%eax
c0107dd2:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0107dd6:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107dda:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107ddd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107de1:	c7 04 24 b0 b6 10 c0 	movl   $0xc010b6b0,(%esp)
c0107de8:	e8 66 85 ff ff       	call   c0100353 <cprintf>
        }
        assert(vma_below_5 == NULL);
c0107ded:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0107df1:	74 24                	je     c0107e17 <check_vma_struct+0x476>
c0107df3:	c7 44 24 0c d5 b6 10 	movl   $0xc010b6d5,0xc(%esp)
c0107dfa:	c0 
c0107dfb:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107e02:	c0 
c0107e03:	c7 44 24 04 e3 00 00 	movl   $0xe3,0x4(%esp)
c0107e0a:	00 
c0107e0b:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107e12:	e8 0c 8e ff ff       	call   c0100c23 <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
    }

    for (i =4; i>=0; i--) {
c0107e17:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
c0107e1b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107e1f:	79 8a                	jns    c0107dab <check_vma_struct+0x40a>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
        }
        assert(vma_below_5 == NULL);
    }

    mm_destroy(mm);
c0107e21:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107e24:	89 04 24             	mov    %eax,(%esp)
c0107e27:	e8 a5 fa ff ff       	call   c01078d1 <mm_destroy>

    assert(nr_free_pages_store == nr_free_pages());
c0107e2c:	e8 e1 ce ff ff       	call   c0104d12 <nr_free_pages>
c0107e31:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0107e34:	74 24                	je     c0107e5a <check_vma_struct+0x4b9>
c0107e36:	c7 44 24 0c 68 b5 10 	movl   $0xc010b568,0xc(%esp)
c0107e3d:	c0 
c0107e3e:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107e45:	c0 
c0107e46:	c7 44 24 04 e8 00 00 	movl   $0xe8,0x4(%esp)
c0107e4d:	00 
c0107e4e:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107e55:	e8 c9 8d ff ff       	call   c0100c23 <__panic>

    cprintf("check_vma_struct() succeeded!\n");
c0107e5a:	c7 04 24 ec b6 10 c0 	movl   $0xc010b6ec,(%esp)
c0107e61:	e8 ed 84 ff ff       	call   c0100353 <cprintf>
}
c0107e66:	c9                   	leave  
c0107e67:	c3                   	ret    

c0107e68 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c0107e68:	55                   	push   %ebp
c0107e69:	89 e5                	mov    %esp,%ebp
c0107e6b:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0107e6e:	e8 9f ce ff ff       	call   c0104d12 <nr_free_pages>
c0107e73:	89 45 ec             	mov    %eax,-0x14(%ebp)

    check_mm_struct = mm_create();
c0107e76:	e8 1e f7 ff ff       	call   c0107599 <mm_create>
c0107e7b:	a3 0c 7c 12 c0       	mov    %eax,0xc0127c0c
    assert(check_mm_struct != NULL);
c0107e80:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c0107e85:	85 c0                	test   %eax,%eax
c0107e87:	75 24                	jne    c0107ead <check_pgfault+0x45>
c0107e89:	c7 44 24 0c 0b b7 10 	movl   $0xc010b70b,0xc(%esp)
c0107e90:	c0 
c0107e91:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107e98:	c0 
c0107e99:	c7 44 24 04 f5 00 00 	movl   $0xf5,0x4(%esp)
c0107ea0:	00 
c0107ea1:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107ea8:	e8 76 8d ff ff       	call   c0100c23 <__panic>

    struct mm_struct *mm = check_mm_struct;
c0107ead:	a1 0c 7c 12 c0       	mov    0xc0127c0c,%eax
c0107eb2:	89 45 e8             	mov    %eax,-0x18(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c0107eb5:	8b 15 44 5a 12 c0    	mov    0xc0125a44,%edx
c0107ebb:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ebe:	89 50 0c             	mov    %edx,0xc(%eax)
c0107ec1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107ec4:	8b 40 0c             	mov    0xc(%eax),%eax
c0107ec7:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(pgdir[0] == 0);
c0107eca:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107ecd:	8b 00                	mov    (%eax),%eax
c0107ecf:	85 c0                	test   %eax,%eax
c0107ed1:	74 24                	je     c0107ef7 <check_pgfault+0x8f>
c0107ed3:	c7 44 24 0c 23 b7 10 	movl   $0xc010b723,0xc(%esp)
c0107eda:	c0 
c0107edb:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107ee2:	c0 
c0107ee3:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0107eea:	00 
c0107eeb:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107ef2:	e8 2c 8d ff ff       	call   c0100c23 <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0107ef7:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0107efe:	00 
c0107eff:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0107f06:	00 
c0107f07:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0107f0e:	e8 fe f6 ff ff       	call   c0107611 <vma_create>
c0107f13:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(vma != NULL);
c0107f16:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0107f1a:	75 24                	jne    c0107f40 <check_pgfault+0xd8>
c0107f1c:	c7 44 24 0c b2 b5 10 	movl   $0xc010b5b2,0xc(%esp)
c0107f23:	c0 
c0107f24:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107f2b:	c0 
c0107f2c:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0107f33:	00 
c0107f34:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107f3b:	e8 e3 8c ff ff       	call   c0100c23 <__panic>

    insert_vma_struct(mm, vma);
c0107f40:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0107f43:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107f47:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107f4a:	89 04 24             	mov    %eax,(%esp)
c0107f4d:	e8 4f f8 ff ff       	call   c01077a1 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0107f52:	c7 45 dc 00 01 00 00 	movl   $0x100,-0x24(%ebp)
    assert(find_vma(mm, addr) == vma);
c0107f59:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107f5c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107f60:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107f63:	89 04 24             	mov    %eax,(%esp)
c0107f66:	e8 e1 f6 ff ff       	call   c010764c <find_vma>
c0107f6b:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0107f6e:	74 24                	je     c0107f94 <check_pgfault+0x12c>
c0107f70:	c7 44 24 0c 31 b7 10 	movl   $0xc010b731,0xc(%esp)
c0107f77:	c0 
c0107f78:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107f7f:	c0 
c0107f80:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c0107f87:	00 
c0107f88:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c0107f8f:	e8 8f 8c ff ff       	call   c0100c23 <__panic>

    int i, sum = 0;
c0107f94:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0107f9b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107fa2:	eb 17                	jmp    c0107fbb <check_pgfault+0x153>
        *(char *)(addr + i) = i;
c0107fa4:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107fa7:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107faa:	01 d0                	add    %edx,%eax
c0107fac:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107faf:	88 10                	mov    %dl,(%eax)
        sum += i;
c0107fb1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107fb4:	01 45 f0             	add    %eax,-0x10(%ebp)

    uintptr_t addr = 0x100;
    assert(find_vma(mm, addr) == vma);

    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
c0107fb7:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107fbb:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0107fbf:	7e e3                	jle    c0107fa4 <check_pgfault+0x13c>
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0107fc1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107fc8:	eb 15                	jmp    c0107fdf <check_pgfault+0x177>
        sum -= *(char *)(addr + i);
c0107fca:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107fcd:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0107fd0:	01 d0                	add    %edx,%eax
c0107fd2:	0f b6 00             	movzbl (%eax),%eax
c0107fd5:	0f be c0             	movsbl %al,%eax
c0107fd8:	29 45 f0             	sub    %eax,-0x10(%ebp)
    int i, sum = 0;
    for (i = 0; i < 100; i ++) {
        *(char *)(addr + i) = i;
        sum += i;
    }
    for (i = 0; i < 100; i ++) {
c0107fdb:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0107fdf:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0107fe3:	7e e5                	jle    c0107fca <check_pgfault+0x162>
        sum -= *(char *)(addr + i);
    }
    assert(sum == 0);
c0107fe5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107fe9:	74 24                	je     c010800f <check_pgfault+0x1a7>
c0107feb:	c7 44 24 0c 4b b7 10 	movl   $0xc010b74b,0xc(%esp)
c0107ff2:	c0 
c0107ff3:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c0107ffa:	c0 
c0107ffb:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c0108002:	00 
c0108003:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c010800a:	e8 14 8c ff ff       	call   c0100c23 <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c010800f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108012:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0108015:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108018:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010801d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108021:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108024:	89 04 24             	mov    %eax,(%esp)
c0108027:	e8 a2 d5 ff ff       	call   c01055ce <page_remove>
    free_page(pa2page(pgdir[0]));
c010802c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010802f:	8b 00                	mov    (%eax),%eax
c0108031:	89 04 24             	mov    %eax,(%esp)
c0108034:	e8 1b f5 ff ff       	call   c0107554 <pa2page>
c0108039:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0108040:	00 
c0108041:	89 04 24             	mov    %eax,(%esp)
c0108044:	e8 97 cc ff ff       	call   c0104ce0 <free_pages>
    pgdir[0] = 0;
c0108049:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010804c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c0108052:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108055:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    mm_destroy(mm);
c010805c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010805f:	89 04 24             	mov    %eax,(%esp)
c0108062:	e8 6a f8 ff ff       	call   c01078d1 <mm_destroy>
    check_mm_struct = NULL;
c0108067:	c7 05 0c 7c 12 c0 00 	movl   $0x0,0xc0127c0c
c010806e:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c0108071:	e8 9c cc ff ff       	call   c0104d12 <nr_free_pages>
c0108076:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0108079:	74 24                	je     c010809f <check_pgfault+0x237>
c010807b:	c7 44 24 0c 68 b5 10 	movl   $0xc010b568,0xc(%esp)
c0108082:	c0 
c0108083:	c7 44 24 08 e7 b4 10 	movl   $0xc010b4e7,0x8(%esp)
c010808a:	c0 
c010808b:	c7 44 24 04 15 01 00 	movl   $0x115,0x4(%esp)
c0108092:	00 
c0108093:	c7 04 24 fc b4 10 c0 	movl   $0xc010b4fc,(%esp)
c010809a:	e8 84 8b ff ff       	call   c0100c23 <__panic>

    cprintf("check_pgfault() succeeded!\n");
c010809f:	c7 04 24 54 b7 10 c0 	movl   $0xc010b754,(%esp)
c01080a6:	e8 a8 82 ff ff       	call   c0100353 <cprintf>
}
c01080ab:	c9                   	leave  
c01080ac:	c3                   	ret    

c01080ad <do_pgfault>:
 *            was a read (0) or write (1).
 *         -- The U/S flag (bit 2) indicates whether the processor was executing at user mode (1)
 *            or supervisor mode (0) at the time of the exception.
 */
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c01080ad:	55                   	push   %ebp
c01080ae:	89 e5                	mov    %esp,%ebp
c01080b0:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_INVAL;
c01080b3:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)
    //try to find a vma which include addr
    struct vma_struct *vma = find_vma(mm, addr);
c01080ba:	8b 45 10             	mov    0x10(%ebp),%eax
c01080bd:	89 44 24 04          	mov    %eax,0x4(%esp)
c01080c1:	8b 45 08             	mov    0x8(%ebp),%eax
c01080c4:	89 04 24             	mov    %eax,(%esp)
c01080c7:	e8 80 f5 ff ff       	call   c010764c <find_vma>
c01080cc:	89 45 f0             	mov    %eax,-0x10(%ebp)

    pgfault_num++;
c01080cf:	a1 d8 5a 12 c0       	mov    0xc0125ad8,%eax
c01080d4:	83 c0 01             	add    $0x1,%eax
c01080d7:	a3 d8 5a 12 c0       	mov    %eax,0xc0125ad8
    //If the addr is in the range of a mm's vma?
    if (vma == NULL || vma->vm_start > addr) {
c01080dc:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01080e0:	74 0b                	je     c01080ed <do_pgfault+0x40>
c01080e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01080e5:	8b 40 04             	mov    0x4(%eax),%eax
c01080e8:	3b 45 10             	cmp    0x10(%ebp),%eax
c01080eb:	76 18                	jbe    c0108105 <do_pgfault+0x58>
        cprintf("not valid addr %x, and  can not find it in vma\n", addr);
c01080ed:	8b 45 10             	mov    0x10(%ebp),%eax
c01080f0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01080f4:	c7 04 24 70 b7 10 c0 	movl   $0xc010b770,(%esp)
c01080fb:	e8 53 82 ff ff       	call   c0100353 <cprintf>
        goto failed;
c0108100:	e9 93 00 00 00       	jmp    c0108198 <do_pgfault+0xeb>
    }
    //check the error_code
    switch (error_code & 3) {
c0108105:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108108:	83 e0 03             	and    $0x3,%eax
c010810b:	85 c0                	test   %eax,%eax
c010810d:	74 30                	je     c010813f <do_pgfault+0x92>
c010810f:	83 f8 01             	cmp    $0x1,%eax
c0108112:	74 1d                	je     c0108131 <do_pgfault+0x84>
    default:
            /* error code flag : default is 3 ( W/R=1, P=1): write, present */
    case 2: /* error code flag : (W/R=1, P=0): write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
c0108114:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108117:	8b 40 0c             	mov    0xc(%eax),%eax
c010811a:	83 e0 02             	and    $0x2,%eax
c010811d:	85 c0                	test   %eax,%eax
c010811f:	75 0e                	jne    c010812f <do_pgfault+0x82>
            cprintf("do_pgfault failed: error code flag = write AND not present, but the addr's vma cannot write\n");
c0108121:	c7 04 24 a0 b7 10 c0 	movl   $0xc010b7a0,(%esp)
c0108128:	e8 26 82 ff ff       	call   c0100353 <cprintf>
            goto failed;
c010812d:	eb 69                	jmp    c0108198 <do_pgfault+0xeb>
        }
        break;
c010812f:	eb 29                	jmp    c010815a <do_pgfault+0xad>
    case 1: /* error code flag : (W/R=0, P=1): read, present */
        cprintf("do_pgfault failed: error code flag = read AND present\n");
c0108131:	c7 04 24 00 b8 10 c0 	movl   $0xc010b800,(%esp)
c0108138:	e8 16 82 ff ff       	call   c0100353 <cprintf>
        goto failed;
c010813d:	eb 59                	jmp    c0108198 <do_pgfault+0xeb>
    case 0: /* error code flag : (W/R=0, P=0): read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c010813f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108142:	8b 40 0c             	mov    0xc(%eax),%eax
c0108145:	83 e0 05             	and    $0x5,%eax
c0108148:	85 c0                	test   %eax,%eax
c010814a:	75 0e                	jne    c010815a <do_pgfault+0xad>
            cprintf("do_pgfault failed: error code flag = read AND not present, but the addr's vma cannot read or exec\n");
c010814c:	c7 04 24 38 b8 10 c0 	movl   $0xc010b838,(%esp)
c0108153:	e8 fb 81 ff ff       	call   c0100353 <cprintf>
            goto failed;
c0108158:	eb 3e                	jmp    c0108198 <do_pgfault+0xeb>
     *    (write an non_existed addr && addr is writable) OR
     *    (read  an non_existed addr && addr is readable)
     * THEN
     *    continue process
     */
    uint32_t perm = PTE_U;
c010815a:	c7 45 ec 04 00 00 00 	movl   $0x4,-0x14(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c0108161:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108164:	8b 40 0c             	mov    0xc(%eax),%eax
c0108167:	83 e0 02             	and    $0x2,%eax
c010816a:	85 c0                	test   %eax,%eax
c010816c:	74 04                	je     c0108172 <do_pgfault+0xc5>
        perm |= PTE_W;
c010816e:	83 4d ec 02          	orl    $0x2,-0x14(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c0108172:	8b 45 10             	mov    0x10(%ebp),%eax
c0108175:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108178:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010817b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0108180:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c0108183:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    pte_t *ptep=NULL;
c010818a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
            cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
            goto failed;
        }
   }
#endif
   ret = 0;
c0108191:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
failed:
    return ret;
c0108198:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010819b:	c9                   	leave  
c010819c:	c3                   	ret    

c010819d <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c010819d:	55                   	push   %ebp
c010819e:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01081a0:	8b 55 08             	mov    0x8(%ebp),%edx
c01081a3:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c01081a8:	29 c2                	sub    %eax,%edx
c01081aa:	89 d0                	mov    %edx,%eax
c01081ac:	c1 f8 05             	sar    $0x5,%eax
}
c01081af:	5d                   	pop    %ebp
c01081b0:	c3                   	ret    

c01081b1 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c01081b1:	55                   	push   %ebp
c01081b2:	89 e5                	mov    %esp,%ebp
c01081b4:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01081b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01081ba:	89 04 24             	mov    %eax,(%esp)
c01081bd:	e8 db ff ff ff       	call   c010819d <page2ppn>
c01081c2:	c1 e0 0c             	shl    $0xc,%eax
}
c01081c5:	c9                   	leave  
c01081c6:	c3                   	ret    

c01081c7 <page2kva>:
    }
    return &pages[PPN(pa)];
}

static inline void *
page2kva(struct Page *page) {
c01081c7:	55                   	push   %ebp
c01081c8:	89 e5                	mov    %esp,%ebp
c01081ca:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01081cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01081d0:	89 04 24             	mov    %eax,(%esp)
c01081d3:	e8 d9 ff ff ff       	call   c01081b1 <page2pa>
c01081d8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01081db:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01081de:	c1 e8 0c             	shr    $0xc,%eax
c01081e1:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01081e4:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01081e9:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01081ec:	72 23                	jb     c0108211 <page2kva+0x4a>
c01081ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01081f1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01081f5:	c7 44 24 08 9c b8 10 	movl   $0xc010b89c,0x8(%esp)
c01081fc:	c0 
c01081fd:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0108204:	00 
c0108205:	c7 04 24 bf b8 10 c0 	movl   $0xc010b8bf,(%esp)
c010820c:	e8 12 8a ff ff       	call   c0100c23 <__panic>
c0108211:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108214:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0108219:	c9                   	leave  
c010821a:	c3                   	ret    

c010821b <swapfs_init>:
#include <ide.h>
#include <pmm.h>
#include <assert.h>

void
swapfs_init(void) {
c010821b:	55                   	push   %ebp
c010821c:	89 e5                	mov    %esp,%ebp
c010821e:	83 ec 18             	sub    $0x18,%esp
    static_assert((PGSIZE % SECTSIZE) == 0);
    if (!ide_device_valid(SWAP_DEV_NO)) {
c0108221:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108228:	e8 46 97 ff ff       	call   c0101973 <ide_device_valid>
c010822d:	85 c0                	test   %eax,%eax
c010822f:	75 1c                	jne    c010824d <swapfs_init+0x32>
        panic("swap fs isn't available.\n");
c0108231:	c7 44 24 08 cd b8 10 	movl   $0xc010b8cd,0x8(%esp)
c0108238:	c0 
c0108239:	c7 44 24 04 0d 00 00 	movl   $0xd,0x4(%esp)
c0108240:	00 
c0108241:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c0108248:	e8 d6 89 ff ff       	call   c0100c23 <__panic>
    }
    max_swap_offset = ide_device_size(SWAP_DEV_NO) / (PGSIZE / SECTSIZE);
c010824d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108254:	e8 59 97 ff ff       	call   c01019b2 <ide_device_size>
c0108259:	c1 e8 03             	shr    $0x3,%eax
c010825c:	a3 dc 7b 12 c0       	mov    %eax,0xc0127bdc
}
c0108261:	c9                   	leave  
c0108262:	c3                   	ret    

c0108263 <swapfs_read>:

int
swapfs_read(swap_entry_t entry, struct Page *page) {
c0108263:	55                   	push   %ebp
c0108264:	89 e5                	mov    %esp,%ebp
c0108266:	83 ec 28             	sub    $0x28,%esp
    return ide_read_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0108269:	8b 45 0c             	mov    0xc(%ebp),%eax
c010826c:	89 04 24             	mov    %eax,(%esp)
c010826f:	e8 53 ff ff ff       	call   c01081c7 <page2kva>
c0108274:	8b 55 08             	mov    0x8(%ebp),%edx
c0108277:	c1 ea 08             	shr    $0x8,%edx
c010827a:	89 55 f4             	mov    %edx,-0xc(%ebp)
c010827d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108281:	74 0b                	je     c010828e <swapfs_read+0x2b>
c0108283:	8b 15 dc 7b 12 c0    	mov    0xc0127bdc,%edx
c0108289:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c010828c:	72 23                	jb     c01082b1 <swapfs_read+0x4e>
c010828e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108291:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108295:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c010829c:	c0 
c010829d:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c01082a4:	00 
c01082a5:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c01082ac:	e8 72 89 ff ff       	call   c0100c23 <__panic>
c01082b1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01082b4:	c1 e2 03             	shl    $0x3,%edx
c01082b7:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c01082be:	00 
c01082bf:	89 44 24 08          	mov    %eax,0x8(%esp)
c01082c3:	89 54 24 04          	mov    %edx,0x4(%esp)
c01082c7:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01082ce:	e8 1e 97 ff ff       	call   c01019f1 <ide_read_secs>
}
c01082d3:	c9                   	leave  
c01082d4:	c3                   	ret    

c01082d5 <swapfs_write>:

int
swapfs_write(swap_entry_t entry, struct Page *page) {
c01082d5:	55                   	push   %ebp
c01082d6:	89 e5                	mov    %esp,%ebp
c01082d8:	83 ec 28             	sub    $0x28,%esp
    return ide_write_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c01082db:	8b 45 0c             	mov    0xc(%ebp),%eax
c01082de:	89 04 24             	mov    %eax,(%esp)
c01082e1:	e8 e1 fe ff ff       	call   c01081c7 <page2kva>
c01082e6:	8b 55 08             	mov    0x8(%ebp),%edx
c01082e9:	c1 ea 08             	shr    $0x8,%edx
c01082ec:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01082ef:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01082f3:	74 0b                	je     c0108300 <swapfs_write+0x2b>
c01082f5:	8b 15 dc 7b 12 c0    	mov    0xc0127bdc,%edx
c01082fb:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c01082fe:	72 23                	jb     c0108323 <swapfs_write+0x4e>
c0108300:	8b 45 08             	mov    0x8(%ebp),%eax
c0108303:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108307:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c010830e:	c0 
c010830f:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c0108316:	00 
c0108317:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c010831e:	e8 00 89 ff ff       	call   c0100c23 <__panic>
c0108323:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108326:	c1 e2 03             	shl    $0x3,%edx
c0108329:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0108330:	00 
c0108331:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108335:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108339:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108340:	e8 ee 98 ff ff       	call   c0101c33 <ide_write_secs>
}
c0108345:	c9                   	leave  
c0108346:	c3                   	ret    

c0108347 <kernel_thread_entry>:
.text
.globl kernel_thread_entry
kernel_thread_entry:        # void kernel_thread(void)

    pushl %edx              # push arg
c0108347:	52                   	push   %edx
    call *%ebx              # call fn
c0108348:	ff d3                	call   *%ebx

    pushl %eax              # save the return value of fn(arg)
c010834a:	50                   	push   %eax
    call do_exit            # call do_exit to terminate current thread
c010834b:	e8 3b 08 00 00       	call   c0108b8b <do_exit>

c0108350 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0108350:	55                   	push   %ebp
c0108351:	89 e5                	mov    %esp,%ebp
c0108353:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0108356:	9c                   	pushf  
c0108357:	58                   	pop    %eax
c0108358:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c010835b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010835e:	25 00 02 00 00       	and    $0x200,%eax
c0108363:	85 c0                	test   %eax,%eax
c0108365:	74 0c                	je     c0108373 <__intr_save+0x23>
        intr_disable();
c0108367:	e8 0f 9b ff ff       	call   c0101e7b <intr_disable>
        return 1;
c010836c:	b8 01 00 00 00       	mov    $0x1,%eax
c0108371:	eb 05                	jmp    c0108378 <__intr_save+0x28>
    }
    return 0;
c0108373:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108378:	c9                   	leave  
c0108379:	c3                   	ret    

c010837a <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c010837a:	55                   	push   %ebp
c010837b:	89 e5                	mov    %esp,%ebp
c010837d:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0108380:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0108384:	74 05                	je     c010838b <__intr_restore+0x11>
        intr_enable();
c0108386:	e8 ea 9a ff ff       	call   c0101e75 <intr_enable>
    }
}
c010838b:	c9                   	leave  
c010838c:	c3                   	ret    

c010838d <page2ppn>:

extern struct Page *pages;
extern size_t npage;

static inline ppn_t
page2ppn(struct Page *page) {
c010838d:	55                   	push   %ebp
c010838e:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0108390:	8b 55 08             	mov    0x8(%ebp),%edx
c0108393:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c0108398:	29 c2                	sub    %eax,%edx
c010839a:	89 d0                	mov    %edx,%eax
c010839c:	c1 f8 05             	sar    $0x5,%eax
}
c010839f:	5d                   	pop    %ebp
c01083a0:	c3                   	ret    

c01083a1 <page2pa>:

static inline uintptr_t
page2pa(struct Page *page) {
c01083a1:	55                   	push   %ebp
c01083a2:	89 e5                	mov    %esp,%ebp
c01083a4:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01083a7:	8b 45 08             	mov    0x8(%ebp),%eax
c01083aa:	89 04 24             	mov    %eax,(%esp)
c01083ad:	e8 db ff ff ff       	call   c010838d <page2ppn>
c01083b2:	c1 e0 0c             	shl    $0xc,%eax
}
c01083b5:	c9                   	leave  
c01083b6:	c3                   	ret    

c01083b7 <pa2page>:

static inline struct Page *
pa2page(uintptr_t pa) {
c01083b7:	55                   	push   %ebp
c01083b8:	89 e5                	mov    %esp,%ebp
c01083ba:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c01083bd:	8b 45 08             	mov    0x8(%ebp),%eax
c01083c0:	c1 e8 0c             	shr    $0xc,%eax
c01083c3:	89 c2                	mov    %eax,%edx
c01083c5:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c01083ca:	39 c2                	cmp    %eax,%edx
c01083cc:	72 1c                	jb     c01083ea <pa2page+0x33>
        panic("pa2page called with invalid pa");
c01083ce:	c7 44 24 08 18 b9 10 	movl   $0xc010b918,0x8(%esp)
c01083d5:	c0 
c01083d6:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c01083dd:	00 
c01083de:	c7 04 24 37 b9 10 c0 	movl   $0xc010b937,(%esp)
c01083e5:	e8 39 88 ff ff       	call   c0100c23 <__panic>
    }
    return &pages[PPN(pa)];
c01083ea:	a1 2c 7b 12 c0       	mov    0xc0127b2c,%eax
c01083ef:	8b 55 08             	mov    0x8(%ebp),%edx
c01083f2:	c1 ea 0c             	shr    $0xc,%edx
c01083f5:	c1 e2 05             	shl    $0x5,%edx
c01083f8:	01 d0                	add    %edx,%eax
}
c01083fa:	c9                   	leave  
c01083fb:	c3                   	ret    

c01083fc <page2kva>:

static inline void *
page2kva(struct Page *page) {
c01083fc:	55                   	push   %ebp
c01083fd:	89 e5                	mov    %esp,%ebp
c01083ff:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0108402:	8b 45 08             	mov    0x8(%ebp),%eax
c0108405:	89 04 24             	mov    %eax,(%esp)
c0108408:	e8 94 ff ff ff       	call   c01083a1 <page2pa>
c010840d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108410:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108413:	c1 e8 0c             	shr    $0xc,%eax
c0108416:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108419:	a1 40 5a 12 c0       	mov    0xc0125a40,%eax
c010841e:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0108421:	72 23                	jb     c0108446 <page2kva+0x4a>
c0108423:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108426:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010842a:	c7 44 24 08 48 b9 10 	movl   $0xc010b948,0x8(%esp)
c0108431:	c0 
c0108432:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0108439:	00 
c010843a:	c7 04 24 37 b9 10 c0 	movl   $0xc010b937,(%esp)
c0108441:	e8 dd 87 ff ff       	call   c0100c23 <__panic>
c0108446:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108449:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010844e:	c9                   	leave  
c010844f:	c3                   	ret    

c0108450 <kva2page>:

static inline struct Page *
kva2page(void *kva) {
c0108450:	55                   	push   %ebp
c0108451:	89 e5                	mov    %esp,%ebp
c0108453:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0108456:	8b 45 08             	mov    0x8(%ebp),%eax
c0108459:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010845c:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0108463:	77 23                	ja     c0108488 <kva2page+0x38>
c0108465:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108468:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010846c:	c7 44 24 08 6c b9 10 	movl   $0xc010b96c,0x8(%esp)
c0108473:	c0 
c0108474:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c010847b:	00 
c010847c:	c7 04 24 37 b9 10 c0 	movl   $0xc010b937,(%esp)
c0108483:	e8 9b 87 ff ff       	call   c0100c23 <__panic>
c0108488:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010848b:	05 00 00 00 40       	add    $0x40000000,%eax
c0108490:	89 04 24             	mov    %eax,(%esp)
c0108493:	e8 1f ff ff ff       	call   c01083b7 <pa2page>
}
c0108498:	c9                   	leave  
c0108499:	c3                   	ret    

c010849a <alloc_proc>:
void forkrets(struct trapframe *tf);
void switch_to(struct context *from, struct context *to);

// alloc_proc - alloc a proc_struct and init all fields of proc_struct
static struct proc_struct *
alloc_proc(void) {
c010849a:	55                   	push   %ebp
c010849b:	89 e5                	mov    %esp,%ebp
c010849d:	83 ec 28             	sub    $0x28,%esp
    struct proc_struct *proc = kmalloc(sizeof(struct proc_struct));
c01084a0:	c7 04 24 68 00 00 00 	movl   $0x68,(%esp)
c01084a7:	e8 6c c3 ff ff       	call   c0104818 <kmalloc>
c01084ac:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (proc != NULL) {
c01084af:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01084b3:	0f 84 a1 00 00 00    	je     c010855a <alloc_proc+0xc0>
    //将线程状态设置成为初始状态
    proc->state=PROC_UNINIT;
c01084b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084bc:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
     proc->pid=-1; //id初始化为-1
c01084c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084c5:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
     proc->runs=0; //运行时间为0
c01084cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084cf:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
     proc->kstack=0; 
c01084d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084d9:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
     proc->need_resched=0; //不需要释放CPU，因为还没有分配
c01084e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084e3:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
     proc->parent=NULL;  //当前没有父进程，初始为null
c01084ea:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084ed:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
     proc->mm=NULL;     //当前未分配内存，初始为null
c01084f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01084f7:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
     //用memset非常方便将context变量中的所有成员变量置为0
     //避免了一一赋值的麻烦。。
     memset(&(proc -> context), 0, sizeof(struct context)); 
c01084fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108501:	83 c0 1c             	add    $0x1c,%eax
c0108504:	c7 44 24 08 20 00 00 	movl   $0x20,0x8(%esp)
c010850b:	00 
c010850c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108513:	00 
c0108514:	89 04 24             	mov    %eax,(%esp)
c0108517:	e8 f1 14 00 00       	call   c0109a0d <memset>
     proc->tf=NULL;   		//当前没有中断帧,初始为null
c010851c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010851f:	c7 40 3c 00 00 00 00 	movl   $0x0,0x3c(%eax)
     proc->cr3=boot_cr3;    //内核线程，cr3 等于boot_cr3
c0108526:	8b 15 28 7b 12 c0    	mov    0xc0127b28,%edx
c010852c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010852f:	89 50 40             	mov    %edx,0x40(%eax)
     proc->flags=0;
c0108532:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108535:	c7 40 44 00 00 00 00 	movl   $0x0,0x44(%eax)
     memset(proc -> name, 0, PROC_NAME_LEN);
c010853c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010853f:	83 c0 48             	add    $0x48,%eax
c0108542:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108549:	00 
c010854a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108551:	00 
c0108552:	89 04 24             	mov    %eax,(%esp)
c0108555:	e8 b3 14 00 00       	call   c0109a0d <memset>

    }
    return proc;
c010855a:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010855d:	c9                   	leave  
c010855e:	c3                   	ret    

c010855f <set_proc_name>:

// set_proc_name - set the name of proc
char *
set_proc_name(struct proc_struct *proc, const char *name) {
c010855f:	55                   	push   %ebp
c0108560:	89 e5                	mov    %esp,%ebp
c0108562:	83 ec 18             	sub    $0x18,%esp
    memset(proc->name, 0, sizeof(proc->name));
c0108565:	8b 45 08             	mov    0x8(%ebp),%eax
c0108568:	83 c0 48             	add    $0x48,%eax
c010856b:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c0108572:	00 
c0108573:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010857a:	00 
c010857b:	89 04 24             	mov    %eax,(%esp)
c010857e:	e8 8a 14 00 00       	call   c0109a0d <memset>
    return memcpy(proc->name, name, PROC_NAME_LEN);
c0108583:	8b 45 08             	mov    0x8(%ebp),%eax
c0108586:	8d 50 48             	lea    0x48(%eax),%edx
c0108589:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108590:	00 
c0108591:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108594:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108598:	89 14 24             	mov    %edx,(%esp)
c010859b:	e8 4f 15 00 00       	call   c0109aef <memcpy>
}
c01085a0:	c9                   	leave  
c01085a1:	c3                   	ret    

c01085a2 <get_proc_name>:

// get_proc_name - get the name of proc
char *
get_proc_name(struct proc_struct *proc) {
c01085a2:	55                   	push   %ebp
c01085a3:	89 e5                	mov    %esp,%ebp
c01085a5:	83 ec 18             	sub    $0x18,%esp
    static char name[PROC_NAME_LEN + 1];
    memset(name, 0, sizeof(name));
c01085a8:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c01085af:	00 
c01085b0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01085b7:	00 
c01085b8:	c7 04 24 04 7b 12 c0 	movl   $0xc0127b04,(%esp)
c01085bf:	e8 49 14 00 00       	call   c0109a0d <memset>
    return memcpy(name, proc->name, PROC_NAME_LEN);
c01085c4:	8b 45 08             	mov    0x8(%ebp),%eax
c01085c7:	83 c0 48             	add    $0x48,%eax
c01085ca:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c01085d1:	00 
c01085d2:	89 44 24 04          	mov    %eax,0x4(%esp)
c01085d6:	c7 04 24 04 7b 12 c0 	movl   $0xc0127b04,(%esp)
c01085dd:	e8 0d 15 00 00       	call   c0109aef <memcpy>
}
c01085e2:	c9                   	leave  
c01085e3:	c3                   	ret    

c01085e4 <get_pid>:

// get_pid - alloc a unique pid for process
static int
get_pid(void) {
c01085e4:	55                   	push   %ebp
c01085e5:	89 e5                	mov    %esp,%ebp
c01085e7:	83 ec 10             	sub    $0x10,%esp
    static_assert(MAX_PID > MAX_PROCESS);
    struct proc_struct *proc;
    list_entry_t *list = &proc_list, *le;
c01085ea:	c7 45 f8 10 7c 12 c0 	movl   $0xc0127c10,-0x8(%ebp)
    static int next_safe = MAX_PID, last_pid = MAX_PID;
    if (++ last_pid >= MAX_PID) {
c01085f1:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c01085f6:	83 c0 01             	add    $0x1,%eax
c01085f9:	a3 80 4a 12 c0       	mov    %eax,0xc0124a80
c01085fe:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c0108603:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108608:	7e 0c                	jle    c0108616 <get_pid+0x32>
        last_pid = 1;
c010860a:	c7 05 80 4a 12 c0 01 	movl   $0x1,0xc0124a80
c0108611:	00 00 00 
        goto inside;
c0108614:	eb 13                	jmp    c0108629 <get_pid+0x45>
    }
    if (last_pid >= next_safe) {
c0108616:	8b 15 80 4a 12 c0    	mov    0xc0124a80,%edx
c010861c:	a1 84 4a 12 c0       	mov    0xc0124a84,%eax
c0108621:	39 c2                	cmp    %eax,%edx
c0108623:	0f 8c ac 00 00 00    	jl     c01086d5 <get_pid+0xf1>
    inside:
        next_safe = MAX_PID;
c0108629:	c7 05 84 4a 12 c0 00 	movl   $0x2000,0xc0124a84
c0108630:	20 00 00 
    repeat:
        le = list;
c0108633:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108636:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while ((le = list_next(le)) != list) {
c0108639:	eb 7f                	jmp    c01086ba <get_pid+0xd6>
            proc = le2proc(le, list_link);
c010863b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010863e:	83 e8 58             	sub    $0x58,%eax
c0108641:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (proc->pid == last_pid) {
c0108644:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108647:	8b 50 04             	mov    0x4(%eax),%edx
c010864a:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c010864f:	39 c2                	cmp    %eax,%edx
c0108651:	75 3e                	jne    c0108691 <get_pid+0xad>
                if (++ last_pid >= next_safe) {
c0108653:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c0108658:	83 c0 01             	add    $0x1,%eax
c010865b:	a3 80 4a 12 c0       	mov    %eax,0xc0124a80
c0108660:	8b 15 80 4a 12 c0    	mov    0xc0124a80,%edx
c0108666:	a1 84 4a 12 c0       	mov    0xc0124a84,%eax
c010866b:	39 c2                	cmp    %eax,%edx
c010866d:	7c 4b                	jl     c01086ba <get_pid+0xd6>
                    if (last_pid >= MAX_PID) {
c010866f:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c0108674:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108679:	7e 0a                	jle    c0108685 <get_pid+0xa1>
                        last_pid = 1;
c010867b:	c7 05 80 4a 12 c0 01 	movl   $0x1,0xc0124a80
c0108682:	00 00 00 
                    }
                    next_safe = MAX_PID;
c0108685:	c7 05 84 4a 12 c0 00 	movl   $0x2000,0xc0124a84
c010868c:	20 00 00 
                    goto repeat;
c010868f:	eb a2                	jmp    c0108633 <get_pid+0x4f>
                }
            }
            else if (proc->pid > last_pid && next_safe > proc->pid) {
c0108691:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108694:	8b 50 04             	mov    0x4(%eax),%edx
c0108697:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
c010869c:	39 c2                	cmp    %eax,%edx
c010869e:	7e 1a                	jle    c01086ba <get_pid+0xd6>
c01086a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01086a3:	8b 50 04             	mov    0x4(%eax),%edx
c01086a6:	a1 84 4a 12 c0       	mov    0xc0124a84,%eax
c01086ab:	39 c2                	cmp    %eax,%edx
c01086ad:	7d 0b                	jge    c01086ba <get_pid+0xd6>
                next_safe = proc->pid;
c01086af:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01086b2:	8b 40 04             	mov    0x4(%eax),%eax
c01086b5:	a3 84 4a 12 c0       	mov    %eax,0xc0124a84
c01086ba:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01086bd:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01086c0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01086c3:	8b 40 04             	mov    0x4(%eax),%eax
    if (last_pid >= next_safe) {
    inside:
        next_safe = MAX_PID;
    repeat:
        le = list;
        while ((le = list_next(le)) != list) {
c01086c6:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01086c9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01086cc:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c01086cf:	0f 85 66 ff ff ff    	jne    c010863b <get_pid+0x57>
            else if (proc->pid > last_pid && next_safe > proc->pid) {
                next_safe = proc->pid;
            }
        }
    }
    return last_pid;
c01086d5:	a1 80 4a 12 c0       	mov    0xc0124a80,%eax
}
c01086da:	c9                   	leave  
c01086db:	c3                   	ret    

c01086dc <proc_run>:

// proc_run - make process "proc" running on cpu
// NOTE: before call switch_to, should load  base addr of "proc"'s new PDT
void
proc_run(struct proc_struct *proc) {
c01086dc:	55                   	push   %ebp
c01086dd:	89 e5                	mov    %esp,%ebp
c01086df:	83 ec 28             	sub    $0x28,%esp
    if (proc != current) {
c01086e2:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c01086e7:	39 45 08             	cmp    %eax,0x8(%ebp)
c01086ea:	74 63                	je     c010874f <proc_run+0x73>
        bool intr_flag;
        struct proc_struct *prev = current, *next = proc;
c01086ec:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c01086f1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01086f4:	8b 45 08             	mov    0x8(%ebp),%eax
c01086f7:	89 45 f0             	mov    %eax,-0x10(%ebp)
        local_intr_save(intr_flag);
c01086fa:	e8 51 fc ff ff       	call   c0108350 <__intr_save>
c01086ff:	89 45 ec             	mov    %eax,-0x14(%ebp)
        {
            current = proc;
c0108702:	8b 45 08             	mov    0x8(%ebp),%eax
c0108705:	a3 e8 5a 12 c0       	mov    %eax,0xc0125ae8
            load_esp0(next->kstack + KSTACKSIZE);
c010870a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010870d:	8b 40 0c             	mov    0xc(%eax),%eax
c0108710:	05 00 20 00 00       	add    $0x2000,%eax
c0108715:	89 04 24             	mov    %eax,(%esp)
c0108718:	e8 0a c4 ff ff       	call   c0104b27 <load_esp0>
            lcr3(next->cr3);
c010871d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108720:	8b 40 40             	mov    0x40(%eax),%eax
c0108723:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("mov %0, %%cr0" :: "r" (cr0) : "memory");
}

static inline void
lcr3(uintptr_t cr3) {
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c0108726:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108729:	0f 22 d8             	mov    %eax,%cr3
            switch_to(&(prev->context), &(next->context));
c010872c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010872f:	8d 50 1c             	lea    0x1c(%eax),%edx
c0108732:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108735:	83 c0 1c             	add    $0x1c,%eax
c0108738:	89 54 24 04          	mov    %edx,0x4(%esp)
c010873c:	89 04 24             	mov    %eax,(%esp)
c010873f:	e8 99 06 00 00       	call   c0108ddd <switch_to>
        }
        local_intr_restore(intr_flag);
c0108744:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108747:	89 04 24             	mov    %eax,(%esp)
c010874a:	e8 2b fc ff ff       	call   c010837a <__intr_restore>
    }
}
c010874f:	c9                   	leave  
c0108750:	c3                   	ret    

c0108751 <forkret>:

// forkret -- the first kernel entry point of a new thread/process
// NOTE: the addr of forkret is setted in copy_thread function
//       after switch_to, the current proc will execute here.
static void
forkret(void) {
c0108751:	55                   	push   %ebp
c0108752:	89 e5                	mov    %esp,%ebp
c0108754:	83 ec 18             	sub    $0x18,%esp
    forkrets(current->tf);
c0108757:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c010875c:	8b 40 3c             	mov    0x3c(%eax),%eax
c010875f:	89 04 24             	mov    %eax,(%esp)
c0108762:	e8 38 9f ff ff       	call   c010269f <forkrets>
}
c0108767:	c9                   	leave  
c0108768:	c3                   	ret    

c0108769 <hash_proc>:

// hash_proc - add proc into proc hash_list
static void
hash_proc(struct proc_struct *proc) {
c0108769:	55                   	push   %ebp
c010876a:	89 e5                	mov    %esp,%ebp
c010876c:	53                   	push   %ebx
c010876d:	83 ec 34             	sub    $0x34,%esp
    list_add(hash_list + pid_hashfn(proc->pid), &(proc->hash_link));
c0108770:	8b 45 08             	mov    0x8(%ebp),%eax
c0108773:	8d 58 60             	lea    0x60(%eax),%ebx
c0108776:	8b 45 08             	mov    0x8(%ebp),%eax
c0108779:	8b 40 04             	mov    0x4(%eax),%eax
c010877c:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108783:	00 
c0108784:	89 04 24             	mov    %eax,(%esp)
c0108787:	e8 d4 07 00 00       	call   c0108f60 <hash32>
c010878c:	c1 e0 03             	shl    $0x3,%eax
c010878f:	05 00 5b 12 c0       	add    $0xc0125b00,%eax
c0108794:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108797:	89 5d f0             	mov    %ebx,-0x10(%ebp)
c010879a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010879d:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01087a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01087a3:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c01087a6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01087a9:	8b 40 04             	mov    0x4(%eax),%eax
c01087ac:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01087af:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c01087b2:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01087b5:	89 55 e0             	mov    %edx,-0x20(%ebp)
c01087b8:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c01087bb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01087be:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01087c1:	89 10                	mov    %edx,(%eax)
c01087c3:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01087c6:	8b 10                	mov    (%eax),%edx
c01087c8:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01087cb:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01087ce:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01087d1:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01087d4:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01087d7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01087da:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01087dd:	89 10                	mov    %edx,(%eax)
}
c01087df:	83 c4 34             	add    $0x34,%esp
c01087e2:	5b                   	pop    %ebx
c01087e3:	5d                   	pop    %ebp
c01087e4:	c3                   	ret    

c01087e5 <find_proc>:

// find_proc - find proc frome proc hash_list according to pid
struct proc_struct *
find_proc(int pid) {
c01087e5:	55                   	push   %ebp
c01087e6:	89 e5                	mov    %esp,%ebp
c01087e8:	83 ec 28             	sub    $0x28,%esp
    if (0 < pid && pid < MAX_PID) {
c01087eb:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01087ef:	7e 5f                	jle    c0108850 <find_proc+0x6b>
c01087f1:	81 7d 08 ff 1f 00 00 	cmpl   $0x1fff,0x8(%ebp)
c01087f8:	7f 56                	jg     c0108850 <find_proc+0x6b>
        list_entry_t *list = hash_list + pid_hashfn(pid), *le = list;
c01087fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01087fd:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108804:	00 
c0108805:	89 04 24             	mov    %eax,(%esp)
c0108808:	e8 53 07 00 00       	call   c0108f60 <hash32>
c010880d:	c1 e0 03             	shl    $0x3,%eax
c0108810:	05 00 5b 12 c0       	add    $0xc0125b00,%eax
c0108815:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108818:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010881b:	89 45 f4             	mov    %eax,-0xc(%ebp)
        while ((le = list_next(le)) != list) {
c010881e:	eb 19                	jmp    c0108839 <find_proc+0x54>
            struct proc_struct *proc = le2proc(le, hash_link);
c0108820:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108823:	83 e8 60             	sub    $0x60,%eax
c0108826:	89 45 ec             	mov    %eax,-0x14(%ebp)
            if (proc->pid == pid) {
c0108829:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010882c:	8b 40 04             	mov    0x4(%eax),%eax
c010882f:	3b 45 08             	cmp    0x8(%ebp),%eax
c0108832:	75 05                	jne    c0108839 <find_proc+0x54>
                return proc;
c0108834:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108837:	eb 1c                	jmp    c0108855 <find_proc+0x70>
c0108839:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010883c:	89 45 e8             	mov    %eax,-0x18(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c010883f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108842:	8b 40 04             	mov    0x4(%eax),%eax
// find_proc - find proc frome proc hash_list according to pid
struct proc_struct *
find_proc(int pid) {
    if (0 < pid && pid < MAX_PID) {
        list_entry_t *list = hash_list + pid_hashfn(pid), *le = list;
        while ((le = list_next(le)) != list) {
c0108845:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108848:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010884b:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010884e:	75 d0                	jne    c0108820 <find_proc+0x3b>
            if (proc->pid == pid) {
                return proc;
            }
        }
    }
    return NULL;
c0108850:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108855:	c9                   	leave  
c0108856:	c3                   	ret    

c0108857 <kernel_thread>:

// kernel_thread - create a kernel thread using "fn" function
// NOTE: the contents of temp trapframe tf will be copied to 
//       proc->tf in do_fork-->copy_thread function
int
kernel_thread(int (*fn)(void *), void *arg, uint32_t clone_flags) {
c0108857:	55                   	push   %ebp
c0108858:	89 e5                	mov    %esp,%ebp
c010885a:	83 ec 68             	sub    $0x68,%esp
    struct trapframe tf;
    memset(&tf, 0, sizeof(struct trapframe));
c010885d:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
c0108864:	00 
c0108865:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010886c:	00 
c010886d:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0108870:	89 04 24             	mov    %eax,(%esp)
c0108873:	e8 95 11 00 00       	call   c0109a0d <memset>
    tf.tf_cs = KERNEL_CS;
c0108878:	66 c7 45 e8 08 00    	movw   $0x8,-0x18(%ebp)
    tf.tf_ds = tf.tf_es = tf.tf_ss = KERNEL_DS;
c010887e:	66 c7 45 f4 10 00    	movw   $0x10,-0xc(%ebp)
c0108884:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0108888:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
c010888c:	0f b7 45 d4          	movzwl -0x2c(%ebp),%eax
c0108890:	66 89 45 d8          	mov    %ax,-0x28(%ebp)
    tf.tf_regs.reg_ebx = (uint32_t)fn;
c0108894:	8b 45 08             	mov    0x8(%ebp),%eax
c0108897:	89 45 bc             	mov    %eax,-0x44(%ebp)
    tf.tf_regs.reg_edx = (uint32_t)arg;
c010889a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010889d:	89 45 c0             	mov    %eax,-0x40(%ebp)
    tf.tf_eip = (uint32_t)kernel_thread_entry;
c01088a0:	b8 47 83 10 c0       	mov    $0xc0108347,%eax
c01088a5:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return do_fork(clone_flags | CLONE_VM, 0, &tf);
c01088a8:	8b 45 10             	mov    0x10(%ebp),%eax
c01088ab:	80 cc 01             	or     $0x1,%ah
c01088ae:	89 c2                	mov    %eax,%edx
c01088b0:	8d 45 ac             	lea    -0x54(%ebp),%eax
c01088b3:	89 44 24 08          	mov    %eax,0x8(%esp)
c01088b7:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01088be:	00 
c01088bf:	89 14 24             	mov    %edx,(%esp)
c01088c2:	e8 79 01 00 00       	call   c0108a40 <do_fork>
}
c01088c7:	c9                   	leave  
c01088c8:	c3                   	ret    

c01088c9 <setup_kstack>:

// setup_kstack - alloc pages with size KSTACKPAGE as process kernel stack
static int
setup_kstack(struct proc_struct *proc) {
c01088c9:	55                   	push   %ebp
c01088ca:	89 e5                	mov    %esp,%ebp
c01088cc:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_pages(KSTACKPAGE);
c01088cf:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c01088d6:	e8 9a c3 ff ff       	call   c0104c75 <alloc_pages>
c01088db:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c01088de:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01088e2:	74 1a                	je     c01088fe <setup_kstack+0x35>
        proc->kstack = (uintptr_t)page2kva(page);
c01088e4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088e7:	89 04 24             	mov    %eax,(%esp)
c01088ea:	e8 0d fb ff ff       	call   c01083fc <page2kva>
c01088ef:	89 c2                	mov    %eax,%edx
c01088f1:	8b 45 08             	mov    0x8(%ebp),%eax
c01088f4:	89 50 0c             	mov    %edx,0xc(%eax)
        return 0;
c01088f7:	b8 00 00 00 00       	mov    $0x0,%eax
c01088fc:	eb 05                	jmp    c0108903 <setup_kstack+0x3a>
    }
    return -E_NO_MEM;
c01088fe:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
}
c0108903:	c9                   	leave  
c0108904:	c3                   	ret    

c0108905 <put_kstack>:

// put_kstack - free the memory space of process kernel stack
static void
put_kstack(struct proc_struct *proc) {
c0108905:	55                   	push   %ebp
c0108906:	89 e5                	mov    %esp,%ebp
c0108908:	83 ec 18             	sub    $0x18,%esp
    free_pages(kva2page((void *)(proc->kstack)), KSTACKPAGE);
c010890b:	8b 45 08             	mov    0x8(%ebp),%eax
c010890e:	8b 40 0c             	mov    0xc(%eax),%eax
c0108911:	89 04 24             	mov    %eax,(%esp)
c0108914:	e8 37 fb ff ff       	call   c0108450 <kva2page>
c0108919:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0108920:	00 
c0108921:	89 04 24             	mov    %eax,(%esp)
c0108924:	e8 b7 c3 ff ff       	call   c0104ce0 <free_pages>
}
c0108929:	c9                   	leave  
c010892a:	c3                   	ret    

c010892b <copy_mm>:

// copy_mm - process "proc" duplicate OR share process "current"'s mm according clone_flags
//         - if clone_flags & CLONE_VM, then "share" ; else "duplicate"
static int
copy_mm(uint32_t clone_flags, struct proc_struct *proc) {
c010892b:	55                   	push   %ebp
c010892c:	89 e5                	mov    %esp,%ebp
c010892e:	83 ec 18             	sub    $0x18,%esp
    assert(current->mm == NULL);
c0108931:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108936:	8b 40 18             	mov    0x18(%eax),%eax
c0108939:	85 c0                	test   %eax,%eax
c010893b:	74 24                	je     c0108961 <copy_mm+0x36>
c010893d:	c7 44 24 0c 90 b9 10 	movl   $0xc010b990,0xc(%esp)
c0108944:	c0 
c0108945:	c7 44 24 08 a4 b9 10 	movl   $0xc010b9a4,0x8(%esp)
c010894c:	c0 
c010894d:	c7 44 24 04 f2 00 00 	movl   $0xf2,0x4(%esp)
c0108954:	00 
c0108955:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c010895c:	e8 c2 82 ff ff       	call   c0100c23 <__panic>
    /* do nothing in this project */
    return 0;
c0108961:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108966:	c9                   	leave  
c0108967:	c3                   	ret    

c0108968 <copy_thread>:

// copy_thread - setup the trapframe on the  process's kernel stack top and
//             - setup the kernel entry point and stack of process
static void
copy_thread(struct proc_struct *proc, uintptr_t esp, struct trapframe *tf) {
c0108968:	55                   	push   %ebp
c0108969:	89 e5                	mov    %esp,%ebp
c010896b:	57                   	push   %edi
c010896c:	56                   	push   %esi
c010896d:	53                   	push   %ebx
    proc->tf = (struct trapframe *)(proc->kstack + KSTACKSIZE) - 1;
c010896e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108971:	8b 40 0c             	mov    0xc(%eax),%eax
c0108974:	05 b4 1f 00 00       	add    $0x1fb4,%eax
c0108979:	89 c2                	mov    %eax,%edx
c010897b:	8b 45 08             	mov    0x8(%ebp),%eax
c010897e:	89 50 3c             	mov    %edx,0x3c(%eax)
    *(proc->tf) = *tf;
c0108981:	8b 45 08             	mov    0x8(%ebp),%eax
c0108984:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108987:	8b 55 10             	mov    0x10(%ebp),%edx
c010898a:	bb 4c 00 00 00       	mov    $0x4c,%ebx
c010898f:	89 c1                	mov    %eax,%ecx
c0108991:	83 e1 01             	and    $0x1,%ecx
c0108994:	85 c9                	test   %ecx,%ecx
c0108996:	74 0e                	je     c01089a6 <copy_thread+0x3e>
c0108998:	0f b6 0a             	movzbl (%edx),%ecx
c010899b:	88 08                	mov    %cl,(%eax)
c010899d:	83 c0 01             	add    $0x1,%eax
c01089a0:	83 c2 01             	add    $0x1,%edx
c01089a3:	83 eb 01             	sub    $0x1,%ebx
c01089a6:	89 c1                	mov    %eax,%ecx
c01089a8:	83 e1 02             	and    $0x2,%ecx
c01089ab:	85 c9                	test   %ecx,%ecx
c01089ad:	74 0f                	je     c01089be <copy_thread+0x56>
c01089af:	0f b7 0a             	movzwl (%edx),%ecx
c01089b2:	66 89 08             	mov    %cx,(%eax)
c01089b5:	83 c0 02             	add    $0x2,%eax
c01089b8:	83 c2 02             	add    $0x2,%edx
c01089bb:	83 eb 02             	sub    $0x2,%ebx
c01089be:	89 d9                	mov    %ebx,%ecx
c01089c0:	c1 e9 02             	shr    $0x2,%ecx
c01089c3:	89 c7                	mov    %eax,%edi
c01089c5:	89 d6                	mov    %edx,%esi
c01089c7:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c01089c9:	89 f2                	mov    %esi,%edx
c01089cb:	89 f8                	mov    %edi,%eax
c01089cd:	b9 00 00 00 00       	mov    $0x0,%ecx
c01089d2:	89 de                	mov    %ebx,%esi
c01089d4:	83 e6 02             	and    $0x2,%esi
c01089d7:	85 f6                	test   %esi,%esi
c01089d9:	74 0b                	je     c01089e6 <copy_thread+0x7e>
c01089db:	0f b7 34 0a          	movzwl (%edx,%ecx,1),%esi
c01089df:	66 89 34 08          	mov    %si,(%eax,%ecx,1)
c01089e3:	83 c1 02             	add    $0x2,%ecx
c01089e6:	83 e3 01             	and    $0x1,%ebx
c01089e9:	85 db                	test   %ebx,%ebx
c01089eb:	74 07                	je     c01089f4 <copy_thread+0x8c>
c01089ed:	0f b6 14 0a          	movzbl (%edx,%ecx,1),%edx
c01089f1:	88 14 08             	mov    %dl,(%eax,%ecx,1)
    proc->tf->tf_regs.reg_eax = 0;
c01089f4:	8b 45 08             	mov    0x8(%ebp),%eax
c01089f7:	8b 40 3c             	mov    0x3c(%eax),%eax
c01089fa:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
    proc->tf->tf_esp = esp;
c0108a01:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a04:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108a07:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108a0a:	89 50 44             	mov    %edx,0x44(%eax)
    proc->tf->tf_eflags |= FL_IF;
c0108a0d:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a10:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108a13:	8b 55 08             	mov    0x8(%ebp),%edx
c0108a16:	8b 52 3c             	mov    0x3c(%edx),%edx
c0108a19:	8b 52 40             	mov    0x40(%edx),%edx
c0108a1c:	80 ce 02             	or     $0x2,%dh
c0108a1f:	89 50 40             	mov    %edx,0x40(%eax)

    proc->context.eip = (uintptr_t)forkret;
c0108a22:	ba 51 87 10 c0       	mov    $0xc0108751,%edx
c0108a27:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a2a:	89 50 1c             	mov    %edx,0x1c(%eax)
    proc->context.esp = (uintptr_t)(proc->tf);
c0108a2d:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a30:	8b 40 3c             	mov    0x3c(%eax),%eax
c0108a33:	89 c2                	mov    %eax,%edx
c0108a35:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a38:	89 50 20             	mov    %edx,0x20(%eax)
}
c0108a3b:	5b                   	pop    %ebx
c0108a3c:	5e                   	pop    %esi
c0108a3d:	5f                   	pop    %edi
c0108a3e:	5d                   	pop    %ebp
c0108a3f:	c3                   	ret    

c0108a40 <do_fork>:
 * @clone_flags: used to guide how to clone the child process
 * @stack:       the parent's user stack pointer. if stack==0, It means to fork a kernel thread.
 * @tf:          the trapframe info, which will be copied to child process's proc->tf
 */
int
do_fork(uint32_t clone_flags, uintptr_t stack, struct trapframe *tf) {
c0108a40:	55                   	push   %ebp
c0108a41:	89 e5                	mov    %esp,%ebp
c0108a43:	83 ec 48             	sub    $0x48,%esp
    int ret = -E_NO_FREE_PROC;
c0108a46:	c7 45 f4 fb ff ff ff 	movl   $0xfffffffb,-0xc(%ebp)
    struct proc_struct *proc;
    if (nr_process >= MAX_PROCESS) {
c0108a4d:	a1 00 7b 12 c0       	mov    0xc0127b00,%eax
c0108a52:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c0108a57:	7e 05                	jle    c0108a5e <do_fork+0x1e>
        goto fork_out;
c0108a59:	e9 19 01 00 00       	jmp    c0108b77 <do_fork+0x137>
    }
    ret = -E_NO_MEM;
c0108a5e:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)
     *   nr_process:   the number of process set
     */


    //1：调用alloc_proc()函数申请内存块，如果失败，直接返回处理
       if ((proc = alloc_proc()) == NULL) {
c0108a65:	e8 30 fa ff ff       	call   c010849a <alloc_proc>
c0108a6a:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108a6d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108a71:	75 05                	jne    c0108a78 <do_fork+0x38>
           goto fork_out;
c0108a73:	e9 ff 00 00 00       	jmp    c0108b77 <do_fork+0x137>
       }
       //2.将子进程的父节点设置为当前进程
           proc->parent = current;
c0108a78:	8b 15 e8 5a 12 c0    	mov    0xc0125ae8,%edx
c0108a7e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108a81:	89 50 14             	mov    %edx,0x14(%eax)
           //3.调用setup_stack()函数为进程分配一个内核栈
           if (setup_kstack(proc) != 0) {
c0108a84:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108a87:	89 04 24             	mov    %eax,(%esp)
c0108a8a:	e8 3a fe ff ff       	call   c01088c9 <setup_kstack>
c0108a8f:	85 c0                	test   %eax,%eax
c0108a91:	74 05                	je     c0108a98 <do_fork+0x58>
               goto bad_fork_cleanup_proc;
c0108a93:	e9 e4 00 00 00       	jmp    c0108b7c <do_fork+0x13c>
           }
           //4.调用copy_mm()函数复制父进程的内存信息到子进程
              if (copy_mm(clone_flags, proc) != 0) {
c0108a98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108a9b:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108a9f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108aa2:	89 04 24             	mov    %eax,(%esp)
c0108aa5:	e8 81 fe ff ff       	call   c010892b <copy_mm>
c0108aaa:	85 c0                	test   %eax,%eax
c0108aac:	74 11                	je     c0108abf <do_fork+0x7f>
                  goto bad_fork_cleanup_kstack;
c0108aae:	90                   	nop
                     ret = proc->pid;
fork_out:
    return ret;

bad_fork_cleanup_kstack:
    put_kstack(proc);
c0108aaf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ab2:	89 04 24             	mov    %eax,(%esp)
c0108ab5:	e8 4b fe ff ff       	call   c0108905 <put_kstack>
c0108aba:	e9 bd 00 00 00       	jmp    c0108b7c <do_fork+0x13c>
           //4.调用copy_mm()函数复制父进程的内存信息到子进程
              if (copy_mm(clone_flags, proc) != 0) {
                  goto bad_fork_cleanup_kstack;
              }
              //5.调用copy_thread()函数复制父进程的中断帧和上下文信息
              copy_thread(proc, stack, tf);
c0108abf:	8b 45 10             	mov    0x10(%ebp),%eax
c0108ac2:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108ac6:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108ac9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108acd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ad0:	89 04 24             	mov    %eax,(%esp)
c0108ad3:	e8 90 fe ff ff       	call   c0108968 <copy_thread>
              //6.将新进程添加到进程的hash列表中
                 bool intr_flag;
                 local_intr_save(intr_flag);
c0108ad8:	e8 73 f8 ff ff       	call   c0108350 <__intr_save>
c0108add:	89 45 ec             	mov    %eax,-0x14(%ebp)
                 {
                     proc->pid = get_pid();
c0108ae0:	e8 ff fa ff ff       	call   c01085e4 <get_pid>
c0108ae5:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108ae8:	89 42 04             	mov    %eax,0x4(%edx)
                     hash_proc(proc); //建立映射
c0108aeb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108aee:	89 04 24             	mov    %eax,(%esp)
c0108af1:	e8 73 fc ff ff       	call   c0108769 <hash_proc>
                     nr_process ++;  //进程数加1
c0108af6:	a1 00 7b 12 c0       	mov    0xc0127b00,%eax
c0108afb:	83 c0 01             	add    $0x1,%eax
c0108afe:	a3 00 7b 12 c0       	mov    %eax,0xc0127b00
                     list_add(&proc_list, &(proc->list_link));//将进程加入到进程的链表中
c0108b03:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b06:	83 c0 58             	add    $0x58,%eax
c0108b09:	c7 45 e8 10 7c 12 c0 	movl   $0xc0127c10,-0x18(%ebp)
c0108b10:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108b13:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108b16:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108b19:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108b1c:	89 45 dc             	mov    %eax,-0x24(%ebp)
 * Insert the new element @elm *after* the element @listelm which
 * is already in the list.
 * */
static inline void
list_add_after(list_entry_t *listelm, list_entry_t *elm) {
    __list_add(elm, listelm, listelm->next);
c0108b1f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108b22:	8b 40 04             	mov    0x4(%eax),%eax
c0108b25:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108b28:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0108b2b:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108b2e:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108b31:	89 45 d0             	mov    %eax,-0x30(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c0108b34:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108b37:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108b3a:	89 10                	mov    %edx,(%eax)
c0108b3c:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108b3f:	8b 10                	mov    (%eax),%edx
c0108b41:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108b44:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108b47:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108b4a:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0108b4d:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0108b50:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108b53:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0108b56:	89 10                	mov    %edx,(%eax)
                 }
                 local_intr_restore(intr_flag);
c0108b58:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108b5b:	89 04 24             	mov    %eax,(%esp)
c0108b5e:	e8 17 f8 ff ff       	call   c010837a <__intr_restore>
                     //      7.一切就绪，唤醒子进程
                     wakeup_proc(proc);
c0108b63:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b66:	89 04 24             	mov    %eax,(%esp)
c0108b69:	e8 e3 02 00 00       	call   c0108e51 <wakeup_proc>
                     //      8.返回子进程的pid
                     ret = proc->pid;
c0108b6e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b71:	8b 40 04             	mov    0x4(%eax),%eax
c0108b74:	89 45 f4             	mov    %eax,-0xc(%ebp)
fork_out:
    return ret;
c0108b77:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b7a:	eb 0d                	jmp    c0108b89 <do_fork+0x149>

bad_fork_cleanup_kstack:
    put_kstack(proc);
bad_fork_cleanup_proc:
    kfree(proc);
c0108b7c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b7f:	89 04 24             	mov    %eax,(%esp)
c0108b82:	e8 ac bc ff ff       	call   c0104833 <kfree>
    goto fork_out;
c0108b87:	eb ee                	jmp    c0108b77 <do_fork+0x137>
}
c0108b89:	c9                   	leave  
c0108b8a:	c3                   	ret    

c0108b8b <do_exit>:
// do_exit - called by sys_exit
//   1. call exit_mmap & put_pgdir & mm_destroy to free the almost all memory space of process
//   2. set process' state as PROC_ZOMBIE, then call wakeup_proc(parent) to ask parent reclaim itself.
//   3. call scheduler to switch to other process
int
do_exit(int error_code) {
c0108b8b:	55                   	push   %ebp
c0108b8c:	89 e5                	mov    %esp,%ebp
c0108b8e:	83 ec 18             	sub    $0x18,%esp
    panic("process exit!!.\n");
c0108b91:	c7 44 24 08 cd b9 10 	movl   $0xc010b9cd,0x8(%esp)
c0108b98:	c0 
c0108b99:	c7 44 24 04 53 01 00 	movl   $0x153,0x4(%esp)
c0108ba0:	00 
c0108ba1:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c0108ba8:	e8 76 80 ff ff       	call   c0100c23 <__panic>

c0108bad <init_main>:
}

// init_main - the second kernel thread used to create user_main kernel threads
static int
init_main(void *arg) {
c0108bad:	55                   	push   %ebp
c0108bae:	89 e5                	mov    %esp,%ebp
c0108bb0:	83 ec 18             	sub    $0x18,%esp
    cprintf("this initproc, pid = %d, name = \"%s\"\n", current->pid, get_proc_name(current));
c0108bb3:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108bb8:	89 04 24             	mov    %eax,(%esp)
c0108bbb:	e8 e2 f9 ff ff       	call   c01085a2 <get_proc_name>
c0108bc0:	8b 15 e8 5a 12 c0    	mov    0xc0125ae8,%edx
c0108bc6:	8b 52 04             	mov    0x4(%edx),%edx
c0108bc9:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108bcd:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108bd1:	c7 04 24 e0 b9 10 c0 	movl   $0xc010b9e0,(%esp)
c0108bd8:	e8 76 77 ff ff       	call   c0100353 <cprintf>
    cprintf("To U: \"%s\".\n", (const char *)arg);
c0108bdd:	8b 45 08             	mov    0x8(%ebp),%eax
c0108be0:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108be4:	c7 04 24 06 ba 10 c0 	movl   $0xc010ba06,(%esp)
c0108beb:	e8 63 77 ff ff       	call   c0100353 <cprintf>
    cprintf("To U: \"en.., Bye, Bye. :)\"\n");
c0108bf0:	c7 04 24 13 ba 10 c0 	movl   $0xc010ba13,(%esp)
c0108bf7:	e8 57 77 ff ff       	call   c0100353 <cprintf>
    return 0;
c0108bfc:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108c01:	c9                   	leave  
c0108c02:	c3                   	ret    

c0108c03 <proc_init>:

// proc_init - set up the first kernel thread idleproc "idle" by itself and 
//           - create the second kernel thread init_main
void
proc_init(void) {
c0108c03:	55                   	push   %ebp
c0108c04:	89 e5                	mov    %esp,%ebp
c0108c06:	83 ec 28             	sub    $0x28,%esp
c0108c09:	c7 45 ec 10 7c 12 c0 	movl   $0xc0127c10,-0x14(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c0108c10:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c13:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108c16:	89 50 04             	mov    %edx,0x4(%eax)
c0108c19:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c1c:	8b 50 04             	mov    0x4(%eax),%edx
c0108c1f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c22:	89 10                	mov    %edx,(%eax)
    int i;

    list_init(&proc_list);
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c0108c24:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0108c2b:	eb 26                	jmp    c0108c53 <proc_init+0x50>
        list_init(hash_list + i);
c0108c2d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108c30:	c1 e0 03             	shl    $0x3,%eax
c0108c33:	05 00 5b 12 c0       	add    $0xc0125b00,%eax
c0108c38:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108c3b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108c3e:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0108c41:	89 50 04             	mov    %edx,0x4(%eax)
c0108c44:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108c47:	8b 50 04             	mov    0x4(%eax),%edx
c0108c4a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108c4d:	89 10                	mov    %edx,(%eax)
void
proc_init(void) {
    int i;

    list_init(&proc_list);
    for (i = 0; i < HASH_LIST_SIZE; i ++) {
c0108c4f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
c0108c53:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
c0108c5a:	7e d1                	jle    c0108c2d <proc_init+0x2a>
        list_init(hash_list + i);
    }

    if ((idleproc = alloc_proc()) == NULL) {
c0108c5c:	e8 39 f8 ff ff       	call   c010849a <alloc_proc>
c0108c61:	a3 e0 5a 12 c0       	mov    %eax,0xc0125ae0
c0108c66:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108c6b:	85 c0                	test   %eax,%eax
c0108c6d:	75 1c                	jne    c0108c8b <proc_init+0x88>
        panic("cannot alloc idleproc.\n");
c0108c6f:	c7 44 24 08 2f ba 10 	movl   $0xc010ba2f,0x8(%esp)
c0108c76:	c0 
c0108c77:	c7 44 24 04 6b 01 00 	movl   $0x16b,0x4(%esp)
c0108c7e:	00 
c0108c7f:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c0108c86:	e8 98 7f ff ff       	call   c0100c23 <__panic>
    }

    idleproc->pid = 0;
c0108c8b:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108c90:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    idleproc->state = PROC_RUNNABLE;
c0108c97:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108c9c:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
    idleproc->kstack = (uintptr_t)bootstack;
c0108ca2:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108ca7:	ba 00 20 12 c0       	mov    $0xc0122000,%edx
c0108cac:	89 50 0c             	mov    %edx,0xc(%eax)
    idleproc->need_resched = 1;
c0108caf:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108cb4:	c7 40 10 01 00 00 00 	movl   $0x1,0x10(%eax)
    set_proc_name(idleproc, "idle");
c0108cbb:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108cc0:	c7 44 24 04 47 ba 10 	movl   $0xc010ba47,0x4(%esp)
c0108cc7:	c0 
c0108cc8:	89 04 24             	mov    %eax,(%esp)
c0108ccb:	e8 8f f8 ff ff       	call   c010855f <set_proc_name>
    nr_process ++;
c0108cd0:	a1 00 7b 12 c0       	mov    0xc0127b00,%eax
c0108cd5:	83 c0 01             	add    $0x1,%eax
c0108cd8:	a3 00 7b 12 c0       	mov    %eax,0xc0127b00

    current = idleproc;
c0108cdd:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108ce2:	a3 e8 5a 12 c0       	mov    %eax,0xc0125ae8

    int pid = kernel_thread(init_main, "Hello world!!", 0);
c0108ce7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0108cee:	00 
c0108cef:	c7 44 24 04 4c ba 10 	movl   $0xc010ba4c,0x4(%esp)
c0108cf6:	c0 
c0108cf7:	c7 04 24 ad 8b 10 c0 	movl   $0xc0108bad,(%esp)
c0108cfe:	e8 54 fb ff ff       	call   c0108857 <kernel_thread>
c0108d03:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (pid <= 0) {
c0108d06:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108d0a:	7f 1c                	jg     c0108d28 <proc_init+0x125>
        panic("create init_main failed.\n");
c0108d0c:	c7 44 24 08 5a ba 10 	movl   $0xc010ba5a,0x8(%esp)
c0108d13:	c0 
c0108d14:	c7 44 24 04 79 01 00 	movl   $0x179,0x4(%esp)
c0108d1b:	00 
c0108d1c:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c0108d23:	e8 fb 7e ff ff       	call   c0100c23 <__panic>
    }

    initproc = find_proc(pid);
c0108d28:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108d2b:	89 04 24             	mov    %eax,(%esp)
c0108d2e:	e8 b2 fa ff ff       	call   c01087e5 <find_proc>
c0108d33:	a3 e4 5a 12 c0       	mov    %eax,0xc0125ae4
    set_proc_name(initproc, "init");
c0108d38:	a1 e4 5a 12 c0       	mov    0xc0125ae4,%eax
c0108d3d:	c7 44 24 04 74 ba 10 	movl   $0xc010ba74,0x4(%esp)
c0108d44:	c0 
c0108d45:	89 04 24             	mov    %eax,(%esp)
c0108d48:	e8 12 f8 ff ff       	call   c010855f <set_proc_name>

    assert(idleproc != NULL && idleproc->pid == 0);
c0108d4d:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108d52:	85 c0                	test   %eax,%eax
c0108d54:	74 0c                	je     c0108d62 <proc_init+0x15f>
c0108d56:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108d5b:	8b 40 04             	mov    0x4(%eax),%eax
c0108d5e:	85 c0                	test   %eax,%eax
c0108d60:	74 24                	je     c0108d86 <proc_init+0x183>
c0108d62:	c7 44 24 0c 7c ba 10 	movl   $0xc010ba7c,0xc(%esp)
c0108d69:	c0 
c0108d6a:	c7 44 24 08 a4 b9 10 	movl   $0xc010b9a4,0x8(%esp)
c0108d71:	c0 
c0108d72:	c7 44 24 04 7f 01 00 	movl   $0x17f,0x4(%esp)
c0108d79:	00 
c0108d7a:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c0108d81:	e8 9d 7e ff ff       	call   c0100c23 <__panic>
    assert(initproc != NULL && initproc->pid == 1);
c0108d86:	a1 e4 5a 12 c0       	mov    0xc0125ae4,%eax
c0108d8b:	85 c0                	test   %eax,%eax
c0108d8d:	74 0d                	je     c0108d9c <proc_init+0x199>
c0108d8f:	a1 e4 5a 12 c0       	mov    0xc0125ae4,%eax
c0108d94:	8b 40 04             	mov    0x4(%eax),%eax
c0108d97:	83 f8 01             	cmp    $0x1,%eax
c0108d9a:	74 24                	je     c0108dc0 <proc_init+0x1bd>
c0108d9c:	c7 44 24 0c a4 ba 10 	movl   $0xc010baa4,0xc(%esp)
c0108da3:	c0 
c0108da4:	c7 44 24 08 a4 b9 10 	movl   $0xc010b9a4,0x8(%esp)
c0108dab:	c0 
c0108dac:	c7 44 24 04 80 01 00 	movl   $0x180,0x4(%esp)
c0108db3:	00 
c0108db4:	c7 04 24 b9 b9 10 c0 	movl   $0xc010b9b9,(%esp)
c0108dbb:	e8 63 7e ff ff       	call   c0100c23 <__panic>
}
c0108dc0:	c9                   	leave  
c0108dc1:	c3                   	ret    

c0108dc2 <cpu_idle>:

// cpu_idle - at the end of kern_init, the first kernel thread idleproc will do below works
void
cpu_idle(void) {
c0108dc2:	55                   	push   %ebp
c0108dc3:	89 e5                	mov    %esp,%ebp
c0108dc5:	83 ec 08             	sub    $0x8,%esp
    while (1) {
        if (current->need_resched) {
c0108dc8:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108dcd:	8b 40 10             	mov    0x10(%eax),%eax
c0108dd0:	85 c0                	test   %eax,%eax
c0108dd2:	74 07                	je     c0108ddb <cpu_idle+0x19>
            schedule();
c0108dd4:	e8 c1 00 00 00       	call   c0108e9a <schedule>
        }
    }
c0108dd9:	eb ed                	jmp    c0108dc8 <cpu_idle+0x6>
c0108ddb:	eb eb                	jmp    c0108dc8 <cpu_idle+0x6>

c0108ddd <switch_to>:
.text
.globl switch_to
switch_to:                      # switch_to(from, to)

    # save from's registers
    movl 4(%esp), %eax          # eax points to from
c0108ddd:	8b 44 24 04          	mov    0x4(%esp),%eax
    popl 0(%eax)                # save eip !popl
c0108de1:	8f 00                	popl   (%eax)
    movl %esp, 4(%eax)
c0108de3:	89 60 04             	mov    %esp,0x4(%eax)
    movl %ebx, 8(%eax)
c0108de6:	89 58 08             	mov    %ebx,0x8(%eax)
    movl %ecx, 12(%eax)
c0108de9:	89 48 0c             	mov    %ecx,0xc(%eax)
    movl %edx, 16(%eax)
c0108dec:	89 50 10             	mov    %edx,0x10(%eax)
    movl %esi, 20(%eax)
c0108def:	89 70 14             	mov    %esi,0x14(%eax)
    movl %edi, 24(%eax)
c0108df2:	89 78 18             	mov    %edi,0x18(%eax)
    movl %ebp, 28(%eax)
c0108df5:	89 68 1c             	mov    %ebp,0x1c(%eax)

    # restore to's registers
    movl 4(%esp), %eax          # not 8(%esp): popped return address already
c0108df8:	8b 44 24 04          	mov    0x4(%esp),%eax
                                # eax now points to to
    movl 28(%eax), %ebp
c0108dfc:	8b 68 1c             	mov    0x1c(%eax),%ebp
    movl 24(%eax), %edi
c0108dff:	8b 78 18             	mov    0x18(%eax),%edi
    movl 20(%eax), %esi
c0108e02:	8b 70 14             	mov    0x14(%eax),%esi
    movl 16(%eax), %edx
c0108e05:	8b 50 10             	mov    0x10(%eax),%edx
    movl 12(%eax), %ecx
c0108e08:	8b 48 0c             	mov    0xc(%eax),%ecx
    movl 8(%eax), %ebx
c0108e0b:	8b 58 08             	mov    0x8(%eax),%ebx
    movl 4(%eax), %esp
c0108e0e:	8b 60 04             	mov    0x4(%eax),%esp

    pushl 0(%eax)               # push eip
c0108e11:	ff 30                	pushl  (%eax)

    ret
c0108e13:	c3                   	ret    

c0108e14 <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c0108e14:	55                   	push   %ebp
c0108e15:	89 e5                	mov    %esp,%ebp
c0108e17:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0108e1a:	9c                   	pushf  
c0108e1b:	58                   	pop    %eax
c0108e1c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0108e1f:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0108e22:	25 00 02 00 00       	and    $0x200,%eax
c0108e27:	85 c0                	test   %eax,%eax
c0108e29:	74 0c                	je     c0108e37 <__intr_save+0x23>
        intr_disable();
c0108e2b:	e8 4b 90 ff ff       	call   c0101e7b <intr_disable>
        return 1;
c0108e30:	b8 01 00 00 00       	mov    $0x1,%eax
c0108e35:	eb 05                	jmp    c0108e3c <__intr_save+0x28>
    }
    return 0;
c0108e37:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108e3c:	c9                   	leave  
c0108e3d:	c3                   	ret    

c0108e3e <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0108e3e:	55                   	push   %ebp
c0108e3f:	89 e5                	mov    %esp,%ebp
c0108e41:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0108e44:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0108e48:	74 05                	je     c0108e4f <__intr_restore+0x11>
        intr_enable();
c0108e4a:	e8 26 90 ff ff       	call   c0101e75 <intr_enable>
    }
}
c0108e4f:	c9                   	leave  
c0108e50:	c3                   	ret    

c0108e51 <wakeup_proc>:
#include <proc.h>
#include <sched.h>
#include <assert.h>

void
wakeup_proc(struct proc_struct *proc) {
c0108e51:	55                   	push   %ebp
c0108e52:	89 e5                	mov    %esp,%ebp
c0108e54:	83 ec 18             	sub    $0x18,%esp
    assert(proc->state != PROC_ZOMBIE && proc->state != PROC_RUNNABLE);
c0108e57:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e5a:	8b 00                	mov    (%eax),%eax
c0108e5c:	83 f8 03             	cmp    $0x3,%eax
c0108e5f:	74 0a                	je     c0108e6b <wakeup_proc+0x1a>
c0108e61:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e64:	8b 00                	mov    (%eax),%eax
c0108e66:	83 f8 02             	cmp    $0x2,%eax
c0108e69:	75 24                	jne    c0108e8f <wakeup_proc+0x3e>
c0108e6b:	c7 44 24 0c cc ba 10 	movl   $0xc010bacc,0xc(%esp)
c0108e72:	c0 
c0108e73:	c7 44 24 08 07 bb 10 	movl   $0xc010bb07,0x8(%esp)
c0108e7a:	c0 
c0108e7b:	c7 44 24 04 09 00 00 	movl   $0x9,0x4(%esp)
c0108e82:	00 
c0108e83:	c7 04 24 1c bb 10 c0 	movl   $0xc010bb1c,(%esp)
c0108e8a:	e8 94 7d ff ff       	call   c0100c23 <__panic>
    proc->state = PROC_RUNNABLE;
c0108e8f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e92:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
}
c0108e98:	c9                   	leave  
c0108e99:	c3                   	ret    

c0108e9a <schedule>:

void
schedule(void) {
c0108e9a:	55                   	push   %ebp
c0108e9b:	89 e5                	mov    %esp,%ebp
c0108e9d:	83 ec 38             	sub    $0x38,%esp
    bool intr_flag;
    list_entry_t *le, *last;
    struct proc_struct *next = NULL;
c0108ea0:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    local_intr_save(intr_flag);
c0108ea7:	e8 68 ff ff ff       	call   c0108e14 <__intr_save>
c0108eac:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {
        current->need_resched = 0;
c0108eaf:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108eb4:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        last = (current == idleproc) ? &proc_list : &(current->list_link);
c0108ebb:	8b 15 e8 5a 12 c0    	mov    0xc0125ae8,%edx
c0108ec1:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108ec6:	39 c2                	cmp    %eax,%edx
c0108ec8:	74 0a                	je     c0108ed4 <schedule+0x3a>
c0108eca:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108ecf:	83 c0 58             	add    $0x58,%eax
c0108ed2:	eb 05                	jmp    c0108ed9 <schedule+0x3f>
c0108ed4:	b8 10 7c 12 c0       	mov    $0xc0127c10,%eax
c0108ed9:	89 45 e8             	mov    %eax,-0x18(%ebp)
        le = last;
c0108edc:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108edf:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108ee2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108ee5:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c0108ee8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108eeb:	8b 40 04             	mov    0x4(%eax),%eax
        do {
            if ((le = list_next(le)) != &proc_list) {
c0108eee:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108ef1:	81 7d f4 10 7c 12 c0 	cmpl   $0xc0127c10,-0xc(%ebp)
c0108ef8:	74 15                	je     c0108f0f <schedule+0x75>
                next = le2proc(le, list_link);
c0108efa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108efd:	83 e8 58             	sub    $0x58,%eax
c0108f00:	89 45 f0             	mov    %eax,-0x10(%ebp)
                if (next->state == PROC_RUNNABLE) {
c0108f03:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f06:	8b 00                	mov    (%eax),%eax
c0108f08:	83 f8 02             	cmp    $0x2,%eax
c0108f0b:	75 02                	jne    c0108f0f <schedule+0x75>
                    break;
c0108f0d:	eb 08                	jmp    c0108f17 <schedule+0x7d>
                }
            }
        } while (le != last);
c0108f0f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108f12:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c0108f15:	75 cb                	jne    c0108ee2 <schedule+0x48>
        if (next == NULL || next->state != PROC_RUNNABLE) {
c0108f17:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108f1b:	74 0a                	je     c0108f27 <schedule+0x8d>
c0108f1d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f20:	8b 00                	mov    (%eax),%eax
c0108f22:	83 f8 02             	cmp    $0x2,%eax
c0108f25:	74 08                	je     c0108f2f <schedule+0x95>
            next = idleproc;
c0108f27:	a1 e0 5a 12 c0       	mov    0xc0125ae0,%eax
c0108f2c:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        next->runs ++;
c0108f2f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f32:	8b 40 08             	mov    0x8(%eax),%eax
c0108f35:	8d 50 01             	lea    0x1(%eax),%edx
c0108f38:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f3b:	89 50 08             	mov    %edx,0x8(%eax)
        if (next != current) {
c0108f3e:	a1 e8 5a 12 c0       	mov    0xc0125ae8,%eax
c0108f43:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0108f46:	74 0b                	je     c0108f53 <schedule+0xb9>
            proc_run(next);
c0108f48:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f4b:	89 04 24             	mov    %eax,(%esp)
c0108f4e:	e8 89 f7 ff ff       	call   c01086dc <proc_run>
        }
    }
    local_intr_restore(intr_flag);
c0108f53:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108f56:	89 04 24             	mov    %eax,(%esp)
c0108f59:	e8 e0 fe ff ff       	call   c0108e3e <__intr_restore>
}
c0108f5e:	c9                   	leave  
c0108f5f:	c3                   	ret    

c0108f60 <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
c0108f60:	55                   	push   %ebp
c0108f61:	89 e5                	mov    %esp,%ebp
c0108f63:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
c0108f66:	8b 45 08             	mov    0x8(%ebp),%eax
c0108f69:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
c0108f6f:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
c0108f72:	b8 20 00 00 00       	mov    $0x20,%eax
c0108f77:	2b 45 0c             	sub    0xc(%ebp),%eax
c0108f7a:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0108f7d:	89 c1                	mov    %eax,%ecx
c0108f7f:	d3 ea                	shr    %cl,%edx
c0108f81:	89 d0                	mov    %edx,%eax
}
c0108f83:	c9                   	leave  
c0108f84:	c3                   	ret    

c0108f85 <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c0108f85:	55                   	push   %ebp
c0108f86:	89 e5                	mov    %esp,%ebp
c0108f88:	83 ec 58             	sub    $0x58,%esp
c0108f8b:	8b 45 10             	mov    0x10(%ebp),%eax
c0108f8e:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0108f91:	8b 45 14             	mov    0x14(%ebp),%eax
c0108f94:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c0108f97:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108f9a:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0108f9d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108fa0:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
c0108fa3:	8b 45 18             	mov    0x18(%ebp),%eax
c0108fa6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108fa9:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fac:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108faf:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108fb2:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0108fb5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108fb8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108fbb:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108fbf:	74 1c                	je     c0108fdd <printnum+0x58>
c0108fc1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108fc4:	ba 00 00 00 00       	mov    $0x0,%edx
c0108fc9:	f7 75 e4             	divl   -0x1c(%ebp)
c0108fcc:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0108fcf:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108fd2:	ba 00 00 00 00       	mov    $0x0,%edx
c0108fd7:	f7 75 e4             	divl   -0x1c(%ebp)
c0108fda:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108fdd:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108fe0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108fe3:	f7 75 e4             	divl   -0x1c(%ebp)
c0108fe6:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108fe9:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0108fec:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108fef:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108ff2:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0108ff5:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0108ff8:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108ffb:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c0108ffe:	8b 45 18             	mov    0x18(%ebp),%eax
c0109001:	ba 00 00 00 00       	mov    $0x0,%edx
c0109006:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c0109009:	77 56                	ja     c0109061 <printnum+0xdc>
c010900b:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
c010900e:	72 05                	jb     c0109015 <printnum+0x90>
c0109010:	3b 45 d0             	cmp    -0x30(%ebp),%eax
c0109013:	77 4c                	ja     c0109061 <printnum+0xdc>
        printnum(putch, putdat, result, base, width - 1, padc);
c0109015:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0109018:	8d 50 ff             	lea    -0x1(%eax),%edx
c010901b:	8b 45 20             	mov    0x20(%ebp),%eax
c010901e:	89 44 24 18          	mov    %eax,0x18(%esp)
c0109022:	89 54 24 14          	mov    %edx,0x14(%esp)
c0109026:	8b 45 18             	mov    0x18(%ebp),%eax
c0109029:	89 44 24 10          	mov    %eax,0x10(%esp)
c010902d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109030:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109033:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109037:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010903b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010903e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109042:	8b 45 08             	mov    0x8(%ebp),%eax
c0109045:	89 04 24             	mov    %eax,(%esp)
c0109048:	e8 38 ff ff ff       	call   c0108f85 <printnum>
c010904d:	eb 1c                	jmp    c010906b <printnum+0xe6>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c010904f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109052:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109056:	8b 45 20             	mov    0x20(%ebp),%eax
c0109059:	89 04 24             	mov    %eax,(%esp)
c010905c:	8b 45 08             	mov    0x8(%ebp),%eax
c010905f:	ff d0                	call   *%eax
    // first recursively print all preceding (more significant) digits
    if (num >= base) {
        printnum(putch, putdat, result, base, width - 1, padc);
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
c0109061:	83 6d 1c 01          	subl   $0x1,0x1c(%ebp)
c0109065:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c0109069:	7f e4                	jg     c010904f <printnum+0xca>
            putch(padc, putdat);
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c010906b:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010906e:	05 b4 bb 10 c0       	add    $0xc010bbb4,%eax
c0109073:	0f b6 00             	movzbl (%eax),%eax
c0109076:	0f be c0             	movsbl %al,%eax
c0109079:	8b 55 0c             	mov    0xc(%ebp),%edx
c010907c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109080:	89 04 24             	mov    %eax,(%esp)
c0109083:	8b 45 08             	mov    0x8(%ebp),%eax
c0109086:	ff d0                	call   *%eax
}
c0109088:	c9                   	leave  
c0109089:	c3                   	ret    

c010908a <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c010908a:	55                   	push   %ebp
c010908b:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c010908d:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c0109091:	7e 14                	jle    c01090a7 <getuint+0x1d>
        return va_arg(*ap, unsigned long long);
c0109093:	8b 45 08             	mov    0x8(%ebp),%eax
c0109096:	8b 00                	mov    (%eax),%eax
c0109098:	8d 48 08             	lea    0x8(%eax),%ecx
c010909b:	8b 55 08             	mov    0x8(%ebp),%edx
c010909e:	89 0a                	mov    %ecx,(%edx)
c01090a0:	8b 50 04             	mov    0x4(%eax),%edx
c01090a3:	8b 00                	mov    (%eax),%eax
c01090a5:	eb 30                	jmp    c01090d7 <getuint+0x4d>
    }
    else if (lflag) {
c01090a7:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01090ab:	74 16                	je     c01090c3 <getuint+0x39>
        return va_arg(*ap, unsigned long);
c01090ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01090b0:	8b 00                	mov    (%eax),%eax
c01090b2:	8d 48 04             	lea    0x4(%eax),%ecx
c01090b5:	8b 55 08             	mov    0x8(%ebp),%edx
c01090b8:	89 0a                	mov    %ecx,(%edx)
c01090ba:	8b 00                	mov    (%eax),%eax
c01090bc:	ba 00 00 00 00       	mov    $0x0,%edx
c01090c1:	eb 14                	jmp    c01090d7 <getuint+0x4d>
    }
    else {
        return va_arg(*ap, unsigned int);
c01090c3:	8b 45 08             	mov    0x8(%ebp),%eax
c01090c6:	8b 00                	mov    (%eax),%eax
c01090c8:	8d 48 04             	lea    0x4(%eax),%ecx
c01090cb:	8b 55 08             	mov    0x8(%ebp),%edx
c01090ce:	89 0a                	mov    %ecx,(%edx)
c01090d0:	8b 00                	mov    (%eax),%eax
c01090d2:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c01090d7:	5d                   	pop    %ebp
c01090d8:	c3                   	ret    

c01090d9 <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c01090d9:	55                   	push   %ebp
c01090da:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c01090dc:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c01090e0:	7e 14                	jle    c01090f6 <getint+0x1d>
        return va_arg(*ap, long long);
c01090e2:	8b 45 08             	mov    0x8(%ebp),%eax
c01090e5:	8b 00                	mov    (%eax),%eax
c01090e7:	8d 48 08             	lea    0x8(%eax),%ecx
c01090ea:	8b 55 08             	mov    0x8(%ebp),%edx
c01090ed:	89 0a                	mov    %ecx,(%edx)
c01090ef:	8b 50 04             	mov    0x4(%eax),%edx
c01090f2:	8b 00                	mov    (%eax),%eax
c01090f4:	eb 28                	jmp    c010911e <getint+0x45>
    }
    else if (lflag) {
c01090f6:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01090fa:	74 12                	je     c010910e <getint+0x35>
        return va_arg(*ap, long);
c01090fc:	8b 45 08             	mov    0x8(%ebp),%eax
c01090ff:	8b 00                	mov    (%eax),%eax
c0109101:	8d 48 04             	lea    0x4(%eax),%ecx
c0109104:	8b 55 08             	mov    0x8(%ebp),%edx
c0109107:	89 0a                	mov    %ecx,(%edx)
c0109109:	8b 00                	mov    (%eax),%eax
c010910b:	99                   	cltd   
c010910c:	eb 10                	jmp    c010911e <getint+0x45>
    }
    else {
        return va_arg(*ap, int);
c010910e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109111:	8b 00                	mov    (%eax),%eax
c0109113:	8d 48 04             	lea    0x4(%eax),%ecx
c0109116:	8b 55 08             	mov    0x8(%ebp),%edx
c0109119:	89 0a                	mov    %ecx,(%edx)
c010911b:	8b 00                	mov    (%eax),%eax
c010911d:	99                   	cltd   
    }
}
c010911e:	5d                   	pop    %ebp
c010911f:	c3                   	ret    

c0109120 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c0109120:	55                   	push   %ebp
c0109121:	89 e5                	mov    %esp,%ebp
c0109123:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c0109126:	8d 45 14             	lea    0x14(%ebp),%eax
c0109129:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c010912c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010912f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109133:	8b 45 10             	mov    0x10(%ebp),%eax
c0109136:	89 44 24 08          	mov    %eax,0x8(%esp)
c010913a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010913d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109141:	8b 45 08             	mov    0x8(%ebp),%eax
c0109144:	89 04 24             	mov    %eax,(%esp)
c0109147:	e8 02 00 00 00       	call   c010914e <vprintfmt>
    va_end(ap);
}
c010914c:	c9                   	leave  
c010914d:	c3                   	ret    

c010914e <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c010914e:	55                   	push   %ebp
c010914f:	89 e5                	mov    %esp,%ebp
c0109151:	56                   	push   %esi
c0109152:	53                   	push   %ebx
c0109153:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109156:	eb 18                	jmp    c0109170 <vprintfmt+0x22>
            if (ch == '\0') {
c0109158:	85 db                	test   %ebx,%ebx
c010915a:	75 05                	jne    c0109161 <vprintfmt+0x13>
                return;
c010915c:	e9 d1 03 00 00       	jmp    c0109532 <vprintfmt+0x3e4>
            }
            putch(ch, putdat);
c0109161:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109164:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109168:	89 1c 24             	mov    %ebx,(%esp)
c010916b:	8b 45 08             	mov    0x8(%ebp),%eax
c010916e:	ff d0                	call   *%eax
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109170:	8b 45 10             	mov    0x10(%ebp),%eax
c0109173:	8d 50 01             	lea    0x1(%eax),%edx
c0109176:	89 55 10             	mov    %edx,0x10(%ebp)
c0109179:	0f b6 00             	movzbl (%eax),%eax
c010917c:	0f b6 d8             	movzbl %al,%ebx
c010917f:	83 fb 25             	cmp    $0x25,%ebx
c0109182:	75 d4                	jne    c0109158 <vprintfmt+0xa>
            }
            putch(ch, putdat);
        }

        // Process a %-escape sequence
        char padc = ' ';
c0109184:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
c0109188:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
c010918f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109192:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
c0109195:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c010919c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010919f:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c01091a2:	8b 45 10             	mov    0x10(%ebp),%eax
c01091a5:	8d 50 01             	lea    0x1(%eax),%edx
c01091a8:	89 55 10             	mov    %edx,0x10(%ebp)
c01091ab:	0f b6 00             	movzbl (%eax),%eax
c01091ae:	0f b6 d8             	movzbl %al,%ebx
c01091b1:	8d 43 dd             	lea    -0x23(%ebx),%eax
c01091b4:	83 f8 55             	cmp    $0x55,%eax
c01091b7:	0f 87 44 03 00 00    	ja     c0109501 <vprintfmt+0x3b3>
c01091bd:	8b 04 85 d8 bb 10 c0 	mov    -0x3fef4428(,%eax,4),%eax
c01091c4:	ff e0                	jmp    *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c01091c6:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
c01091ca:	eb d6                	jmp    c01091a2 <vprintfmt+0x54>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c01091cc:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
c01091d0:	eb d0                	jmp    c01091a2 <vprintfmt+0x54>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c01091d2:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
c01091d9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01091dc:	89 d0                	mov    %edx,%eax
c01091de:	c1 e0 02             	shl    $0x2,%eax
c01091e1:	01 d0                	add    %edx,%eax
c01091e3:	01 c0                	add    %eax,%eax
c01091e5:	01 d8                	add    %ebx,%eax
c01091e7:	83 e8 30             	sub    $0x30,%eax
c01091ea:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
c01091ed:	8b 45 10             	mov    0x10(%ebp),%eax
c01091f0:	0f b6 00             	movzbl (%eax),%eax
c01091f3:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c01091f6:	83 fb 2f             	cmp    $0x2f,%ebx
c01091f9:	7e 0b                	jle    c0109206 <vprintfmt+0xb8>
c01091fb:	83 fb 39             	cmp    $0x39,%ebx
c01091fe:	7f 06                	jg     c0109206 <vprintfmt+0xb8>
            padc = '0';
            goto reswitch;

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c0109200:	83 45 10 01          	addl   $0x1,0x10(%ebp)
                precision = precision * 10 + ch - '0';
                ch = *fmt;
                if (ch < '0' || ch > '9') {
                    break;
                }
            }
c0109204:	eb d3                	jmp    c01091d9 <vprintfmt+0x8b>
            goto process_precision;
c0109206:	eb 33                	jmp    c010923b <vprintfmt+0xed>

        case '*':
            precision = va_arg(ap, int);
c0109208:	8b 45 14             	mov    0x14(%ebp),%eax
c010920b:	8d 50 04             	lea    0x4(%eax),%edx
c010920e:	89 55 14             	mov    %edx,0x14(%ebp)
c0109211:	8b 00                	mov    (%eax),%eax
c0109213:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
c0109216:	eb 23                	jmp    c010923b <vprintfmt+0xed>

        case '.':
            if (width < 0)
c0109218:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010921c:	79 0c                	jns    c010922a <vprintfmt+0xdc>
                width = 0;
c010921e:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
c0109225:	e9 78 ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>
c010922a:	e9 73 ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>

        case '#':
            altflag = 1;
c010922f:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
c0109236:	e9 67 ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>

        process_precision:
            if (width < 0)
c010923b:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010923f:	79 12                	jns    c0109253 <vprintfmt+0x105>
                width = precision, precision = -1;
c0109241:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109244:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109247:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
c010924e:	e9 4f ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>
c0109253:	e9 4a ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c0109258:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
            goto reswitch;
c010925c:	e9 41 ff ff ff       	jmp    c01091a2 <vprintfmt+0x54>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c0109261:	8b 45 14             	mov    0x14(%ebp),%eax
c0109264:	8d 50 04             	lea    0x4(%eax),%edx
c0109267:	89 55 14             	mov    %edx,0x14(%ebp)
c010926a:	8b 00                	mov    (%eax),%eax
c010926c:	8b 55 0c             	mov    0xc(%ebp),%edx
c010926f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109273:	89 04 24             	mov    %eax,(%esp)
c0109276:	8b 45 08             	mov    0x8(%ebp),%eax
c0109279:	ff d0                	call   *%eax
            break;
c010927b:	e9 ac 02 00 00       	jmp    c010952c <vprintfmt+0x3de>

        // error message
        case 'e':
            err = va_arg(ap, int);
c0109280:	8b 45 14             	mov    0x14(%ebp),%eax
c0109283:	8d 50 04             	lea    0x4(%eax),%edx
c0109286:	89 55 14             	mov    %edx,0x14(%ebp)
c0109289:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c010928b:	85 db                	test   %ebx,%ebx
c010928d:	79 02                	jns    c0109291 <vprintfmt+0x143>
                err = -err;
c010928f:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c0109291:	83 fb 06             	cmp    $0x6,%ebx
c0109294:	7f 0b                	jg     c01092a1 <vprintfmt+0x153>
c0109296:	8b 34 9d 98 bb 10 c0 	mov    -0x3fef4468(,%ebx,4),%esi
c010929d:	85 f6                	test   %esi,%esi
c010929f:	75 23                	jne    c01092c4 <vprintfmt+0x176>
                printfmt(putch, putdat, "error %d", err);
c01092a1:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01092a5:	c7 44 24 08 c5 bb 10 	movl   $0xc010bbc5,0x8(%esp)
c01092ac:	c0 
c01092ad:	8b 45 0c             	mov    0xc(%ebp),%eax
c01092b0:	89 44 24 04          	mov    %eax,0x4(%esp)
c01092b4:	8b 45 08             	mov    0x8(%ebp),%eax
c01092b7:	89 04 24             	mov    %eax,(%esp)
c01092ba:	e8 61 fe ff ff       	call   c0109120 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c01092bf:	e9 68 02 00 00       	jmp    c010952c <vprintfmt+0x3de>
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
                printfmt(putch, putdat, "error %d", err);
            }
            else {
                printfmt(putch, putdat, "%s", p);
c01092c4:	89 74 24 0c          	mov    %esi,0xc(%esp)
c01092c8:	c7 44 24 08 ce bb 10 	movl   $0xc010bbce,0x8(%esp)
c01092cf:	c0 
c01092d0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01092d3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01092d7:	8b 45 08             	mov    0x8(%ebp),%eax
c01092da:	89 04 24             	mov    %eax,(%esp)
c01092dd:	e8 3e fe ff ff       	call   c0109120 <printfmt>
            }
            break;
c01092e2:	e9 45 02 00 00       	jmp    c010952c <vprintfmt+0x3de>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c01092e7:	8b 45 14             	mov    0x14(%ebp),%eax
c01092ea:	8d 50 04             	lea    0x4(%eax),%edx
c01092ed:	89 55 14             	mov    %edx,0x14(%ebp)
c01092f0:	8b 30                	mov    (%eax),%esi
c01092f2:	85 f6                	test   %esi,%esi
c01092f4:	75 05                	jne    c01092fb <vprintfmt+0x1ad>
                p = "(null)";
c01092f6:	be d1 bb 10 c0       	mov    $0xc010bbd1,%esi
            }
            if (width > 0 && padc != '-') {
c01092fb:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01092ff:	7e 3e                	jle    c010933f <vprintfmt+0x1f1>
c0109301:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
c0109305:	74 38                	je     c010933f <vprintfmt+0x1f1>
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109307:	8b 5d e8             	mov    -0x18(%ebp),%ebx
c010930a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010930d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109311:	89 34 24             	mov    %esi,(%esp)
c0109314:	e8 ed 03 00 00       	call   c0109706 <strnlen>
c0109319:	29 c3                	sub    %eax,%ebx
c010931b:	89 d8                	mov    %ebx,%eax
c010931d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109320:	eb 17                	jmp    c0109339 <vprintfmt+0x1eb>
                    putch(padc, putdat);
c0109322:	0f be 45 db          	movsbl -0x25(%ebp),%eax
c0109326:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109329:	89 54 24 04          	mov    %edx,0x4(%esp)
c010932d:	89 04 24             	mov    %eax,(%esp)
c0109330:	8b 45 08             	mov    0x8(%ebp),%eax
c0109333:	ff d0                	call   *%eax
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
                p = "(null)";
            }
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109335:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c0109339:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010933d:	7f e3                	jg     c0109322 <vprintfmt+0x1d4>
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c010933f:	eb 38                	jmp    c0109379 <vprintfmt+0x22b>
                if (altflag && (ch < ' ' || ch > '~')) {
c0109341:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0109345:	74 1f                	je     c0109366 <vprintfmt+0x218>
c0109347:	83 fb 1f             	cmp    $0x1f,%ebx
c010934a:	7e 05                	jle    c0109351 <vprintfmt+0x203>
c010934c:	83 fb 7e             	cmp    $0x7e,%ebx
c010934f:	7e 15                	jle    c0109366 <vprintfmt+0x218>
                    putch('?', putdat);
c0109351:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109354:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109358:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c010935f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109362:	ff d0                	call   *%eax
c0109364:	eb 0f                	jmp    c0109375 <vprintfmt+0x227>
                }
                else {
                    putch(ch, putdat);
c0109366:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109369:	89 44 24 04          	mov    %eax,0x4(%esp)
c010936d:	89 1c 24             	mov    %ebx,(%esp)
c0109370:	8b 45 08             	mov    0x8(%ebp),%eax
c0109373:	ff d0                	call   *%eax
            if (width > 0 && padc != '-') {
                for (width -= strnlen(p, precision); width > 0; width --) {
                    putch(padc, putdat);
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0109375:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c0109379:	89 f0                	mov    %esi,%eax
c010937b:	8d 70 01             	lea    0x1(%eax),%esi
c010937e:	0f b6 00             	movzbl (%eax),%eax
c0109381:	0f be d8             	movsbl %al,%ebx
c0109384:	85 db                	test   %ebx,%ebx
c0109386:	74 10                	je     c0109398 <vprintfmt+0x24a>
c0109388:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010938c:	78 b3                	js     c0109341 <vprintfmt+0x1f3>
c010938e:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
c0109392:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109396:	79 a9                	jns    c0109341 <vprintfmt+0x1f3>
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c0109398:	eb 17                	jmp    c01093b1 <vprintfmt+0x263>
                putch(' ', putdat);
c010939a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010939d:	89 44 24 04          	mov    %eax,0x4(%esp)
c01093a1:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c01093a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01093ab:	ff d0                	call   *%eax
                }
                else {
                    putch(ch, putdat);
                }
            }
            for (; width > 0; width --) {
c01093ad:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
c01093b1:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01093b5:	7f e3                	jg     c010939a <vprintfmt+0x24c>
                putch(' ', putdat);
            }
            break;
c01093b7:	e9 70 01 00 00       	jmp    c010952c <vprintfmt+0x3de>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c01093bc:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01093bf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01093c3:	8d 45 14             	lea    0x14(%ebp),%eax
c01093c6:	89 04 24             	mov    %eax,(%esp)
c01093c9:	e8 0b fd ff ff       	call   c01090d9 <getint>
c01093ce:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01093d1:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
c01093d4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093d7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01093da:	85 d2                	test   %edx,%edx
c01093dc:	79 26                	jns    c0109404 <vprintfmt+0x2b6>
                putch('-', putdat);
c01093de:	8b 45 0c             	mov    0xc(%ebp),%eax
c01093e1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01093e5:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c01093ec:	8b 45 08             	mov    0x8(%ebp),%eax
c01093ef:	ff d0                	call   *%eax
                num = -(long long)num;
c01093f1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093f4:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01093f7:	f7 d8                	neg    %eax
c01093f9:	83 d2 00             	adc    $0x0,%edx
c01093fc:	f7 da                	neg    %edx
c01093fe:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109401:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
c0109404:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c010940b:	e9 a8 00 00 00       	jmp    c01094b8 <vprintfmt+0x36a>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c0109410:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109413:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109417:	8d 45 14             	lea    0x14(%ebp),%eax
c010941a:	89 04 24             	mov    %eax,(%esp)
c010941d:	e8 68 fc ff ff       	call   c010908a <getuint>
c0109422:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109425:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
c0109428:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c010942f:	e9 84 00 00 00       	jmp    c01094b8 <vprintfmt+0x36a>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c0109434:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109437:	89 44 24 04          	mov    %eax,0x4(%esp)
c010943b:	8d 45 14             	lea    0x14(%ebp),%eax
c010943e:	89 04 24             	mov    %eax,(%esp)
c0109441:	e8 44 fc ff ff       	call   c010908a <getuint>
c0109446:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109449:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
c010944c:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
c0109453:	eb 63                	jmp    c01094b8 <vprintfmt+0x36a>

        // pointer
        case 'p':
            putch('0', putdat);
c0109455:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109458:	89 44 24 04          	mov    %eax,0x4(%esp)
c010945c:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c0109463:	8b 45 08             	mov    0x8(%ebp),%eax
c0109466:	ff d0                	call   *%eax
            putch('x', putdat);
c0109468:	8b 45 0c             	mov    0xc(%ebp),%eax
c010946b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010946f:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c0109476:	8b 45 08             	mov    0x8(%ebp),%eax
c0109479:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c010947b:	8b 45 14             	mov    0x14(%ebp),%eax
c010947e:	8d 50 04             	lea    0x4(%eax),%edx
c0109481:	89 55 14             	mov    %edx,0x14(%ebp)
c0109484:	8b 00                	mov    (%eax),%eax
c0109486:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109489:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
c0109490:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
c0109497:	eb 1f                	jmp    c01094b8 <vprintfmt+0x36a>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c0109499:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010949c:	89 44 24 04          	mov    %eax,0x4(%esp)
c01094a0:	8d 45 14             	lea    0x14(%ebp),%eax
c01094a3:	89 04 24             	mov    %eax,(%esp)
c01094a6:	e8 df fb ff ff       	call   c010908a <getuint>
c01094ab:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01094ae:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
c01094b1:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c01094b8:	0f be 55 db          	movsbl -0x25(%ebp),%edx
c01094bc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01094bf:	89 54 24 18          	mov    %edx,0x18(%esp)
c01094c3:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01094c6:	89 54 24 14          	mov    %edx,0x14(%esp)
c01094ca:	89 44 24 10          	mov    %eax,0x10(%esp)
c01094ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01094d1:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01094d4:	89 44 24 08          	mov    %eax,0x8(%esp)
c01094d8:	89 54 24 0c          	mov    %edx,0xc(%esp)
c01094dc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094df:	89 44 24 04          	mov    %eax,0x4(%esp)
c01094e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01094e6:	89 04 24             	mov    %eax,(%esp)
c01094e9:	e8 97 fa ff ff       	call   c0108f85 <printnum>
            break;
c01094ee:	eb 3c                	jmp    c010952c <vprintfmt+0x3de>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c01094f0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094f3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01094f7:	89 1c 24             	mov    %ebx,(%esp)
c01094fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01094fd:	ff d0                	call   *%eax
            break;
c01094ff:	eb 2b                	jmp    c010952c <vprintfmt+0x3de>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c0109501:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109504:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109508:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c010950f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109512:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c0109514:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c0109518:	eb 04                	jmp    c010951e <vprintfmt+0x3d0>
c010951a:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c010951e:	8b 45 10             	mov    0x10(%ebp),%eax
c0109521:	83 e8 01             	sub    $0x1,%eax
c0109524:	0f b6 00             	movzbl (%eax),%eax
c0109527:	3c 25                	cmp    $0x25,%al
c0109529:	75 ef                	jne    c010951a <vprintfmt+0x3cc>
                /* do nothing */;
            break;
c010952b:	90                   	nop
        }
    }
c010952c:	90                   	nop
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c010952d:	e9 3e fc ff ff       	jmp    c0109170 <vprintfmt+0x22>
            for (fmt --; fmt[-1] != '%'; fmt --)
                /* do nothing */;
            break;
        }
    }
}
c0109532:	83 c4 40             	add    $0x40,%esp
c0109535:	5b                   	pop    %ebx
c0109536:	5e                   	pop    %esi
c0109537:	5d                   	pop    %ebp
c0109538:	c3                   	ret    

c0109539 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c0109539:	55                   	push   %ebp
c010953a:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c010953c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010953f:	8b 40 08             	mov    0x8(%eax),%eax
c0109542:	8d 50 01             	lea    0x1(%eax),%edx
c0109545:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109548:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c010954b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010954e:	8b 10                	mov    (%eax),%edx
c0109550:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109553:	8b 40 04             	mov    0x4(%eax),%eax
c0109556:	39 c2                	cmp    %eax,%edx
c0109558:	73 12                	jae    c010956c <sprintputch+0x33>
        *b->buf ++ = ch;
c010955a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010955d:	8b 00                	mov    (%eax),%eax
c010955f:	8d 48 01             	lea    0x1(%eax),%ecx
c0109562:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109565:	89 0a                	mov    %ecx,(%edx)
c0109567:	8b 55 08             	mov    0x8(%ebp),%edx
c010956a:	88 10                	mov    %dl,(%eax)
    }
}
c010956c:	5d                   	pop    %ebp
c010956d:	c3                   	ret    

c010956e <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c010956e:	55                   	push   %ebp
c010956f:	89 e5                	mov    %esp,%ebp
c0109571:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c0109574:	8d 45 14             	lea    0x14(%ebp),%eax
c0109577:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c010957a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010957d:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109581:	8b 45 10             	mov    0x10(%ebp),%eax
c0109584:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109588:	8b 45 0c             	mov    0xc(%ebp),%eax
c010958b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010958f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109592:	89 04 24             	mov    %eax,(%esp)
c0109595:	e8 08 00 00 00       	call   c01095a2 <vsnprintf>
c010959a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c010959d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01095a0:	c9                   	leave  
c01095a1:	c3                   	ret    

c01095a2 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c01095a2:	55                   	push   %ebp
c01095a3:	89 e5                	mov    %esp,%ebp
c01095a5:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c01095a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01095ab:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01095ae:	8b 45 0c             	mov    0xc(%ebp),%eax
c01095b1:	8d 50 ff             	lea    -0x1(%eax),%edx
c01095b4:	8b 45 08             	mov    0x8(%ebp),%eax
c01095b7:	01 d0                	add    %edx,%eax
c01095b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01095bc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c01095c3:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01095c7:	74 0a                	je     c01095d3 <vsnprintf+0x31>
c01095c9:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01095cc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01095cf:	39 c2                	cmp    %eax,%edx
c01095d1:	76 07                	jbe    c01095da <vsnprintf+0x38>
        return -E_INVAL;
c01095d3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c01095d8:	eb 2a                	jmp    c0109604 <vsnprintf+0x62>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c01095da:	8b 45 14             	mov    0x14(%ebp),%eax
c01095dd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01095e1:	8b 45 10             	mov    0x10(%ebp),%eax
c01095e4:	89 44 24 08          	mov    %eax,0x8(%esp)
c01095e8:	8d 45 ec             	lea    -0x14(%ebp),%eax
c01095eb:	89 44 24 04          	mov    %eax,0x4(%esp)
c01095ef:	c7 04 24 39 95 10 c0 	movl   $0xc0109539,(%esp)
c01095f6:	e8 53 fb ff ff       	call   c010914e <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c01095fb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01095fe:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c0109601:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109604:	c9                   	leave  
c0109605:	c3                   	ret    

c0109606 <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c0109606:	55                   	push   %ebp
c0109607:	89 e5                	mov    %esp,%ebp
c0109609:	57                   	push   %edi
c010960a:	56                   	push   %esi
c010960b:	53                   	push   %ebx
c010960c:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c010960f:	a1 88 4a 12 c0       	mov    0xc0124a88,%eax
c0109614:	8b 15 8c 4a 12 c0    	mov    0xc0124a8c,%edx
c010961a:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
c0109620:	6b f0 05             	imul   $0x5,%eax,%esi
c0109623:	01 f7                	add    %esi,%edi
c0109625:	be 6d e6 ec de       	mov    $0xdeece66d,%esi
c010962a:	f7 e6                	mul    %esi
c010962c:	8d 34 17             	lea    (%edi,%edx,1),%esi
c010962f:	89 f2                	mov    %esi,%edx
c0109631:	83 c0 0b             	add    $0xb,%eax
c0109634:	83 d2 00             	adc    $0x0,%edx
c0109637:	89 c7                	mov    %eax,%edi
c0109639:	83 e7 ff             	and    $0xffffffff,%edi
c010963c:	89 f9                	mov    %edi,%ecx
c010963e:	0f b7 da             	movzwl %dx,%ebx
c0109641:	89 0d 88 4a 12 c0    	mov    %ecx,0xc0124a88
c0109647:	89 1d 8c 4a 12 c0    	mov    %ebx,0xc0124a8c
    unsigned long long result = (next >> 12);
c010964d:	a1 88 4a 12 c0       	mov    0xc0124a88,%eax
c0109652:	8b 15 8c 4a 12 c0    	mov    0xc0124a8c,%edx
c0109658:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c010965c:	c1 ea 0c             	shr    $0xc,%edx
c010965f:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109662:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c0109665:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
c010966c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010966f:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109672:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0109675:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0109678:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010967b:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010967e:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109682:	74 1c                	je     c01096a0 <rand+0x9a>
c0109684:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109687:	ba 00 00 00 00       	mov    $0x0,%edx
c010968c:	f7 75 dc             	divl   -0x24(%ebp)
c010968f:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0109692:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109695:	ba 00 00 00 00       	mov    $0x0,%edx
c010969a:	f7 75 dc             	divl   -0x24(%ebp)
c010969d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01096a0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01096a3:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01096a6:	f7 75 dc             	divl   -0x24(%ebp)
c01096a9:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01096ac:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01096af:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01096b2:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01096b5:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01096b8:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c01096bb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c01096be:	83 c4 24             	add    $0x24,%esp
c01096c1:	5b                   	pop    %ebx
c01096c2:	5e                   	pop    %esi
c01096c3:	5f                   	pop    %edi
c01096c4:	5d                   	pop    %ebp
c01096c5:	c3                   	ret    

c01096c6 <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c01096c6:	55                   	push   %ebp
c01096c7:	89 e5                	mov    %esp,%ebp
    next = seed;
c01096c9:	8b 45 08             	mov    0x8(%ebp),%eax
c01096cc:	ba 00 00 00 00       	mov    $0x0,%edx
c01096d1:	a3 88 4a 12 c0       	mov    %eax,0xc0124a88
c01096d6:	89 15 8c 4a 12 c0    	mov    %edx,0xc0124a8c
}
c01096dc:	5d                   	pop    %ebp
c01096dd:	c3                   	ret    

c01096de <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c01096de:	55                   	push   %ebp
c01096df:	89 e5                	mov    %esp,%ebp
c01096e1:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c01096e4:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c01096eb:	eb 04                	jmp    c01096f1 <strlen+0x13>
        cnt ++;
c01096ed:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
    size_t cnt = 0;
    while (*s ++ != '\0') {
c01096f1:	8b 45 08             	mov    0x8(%ebp),%eax
c01096f4:	8d 50 01             	lea    0x1(%eax),%edx
c01096f7:	89 55 08             	mov    %edx,0x8(%ebp)
c01096fa:	0f b6 00             	movzbl (%eax),%eax
c01096fd:	84 c0                	test   %al,%al
c01096ff:	75 ec                	jne    c01096ed <strlen+0xf>
        cnt ++;
    }
    return cnt;
c0109701:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0109704:	c9                   	leave  
c0109705:	c3                   	ret    

c0109706 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c0109706:	55                   	push   %ebp
c0109707:	89 e5                	mov    %esp,%ebp
c0109709:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c010970c:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c0109713:	eb 04                	jmp    c0109719 <strnlen+0x13>
        cnt ++;
c0109715:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
    size_t cnt = 0;
    while (cnt < len && *s ++ != '\0') {
c0109719:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010971c:	3b 45 0c             	cmp    0xc(%ebp),%eax
c010971f:	73 10                	jae    c0109731 <strnlen+0x2b>
c0109721:	8b 45 08             	mov    0x8(%ebp),%eax
c0109724:	8d 50 01             	lea    0x1(%eax),%edx
c0109727:	89 55 08             	mov    %edx,0x8(%ebp)
c010972a:	0f b6 00             	movzbl (%eax),%eax
c010972d:	84 c0                	test   %al,%al
c010972f:	75 e4                	jne    c0109715 <strnlen+0xf>
        cnt ++;
    }
    return cnt;
c0109731:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0109734:	c9                   	leave  
c0109735:	c3                   	ret    

c0109736 <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c0109736:	55                   	push   %ebp
c0109737:	89 e5                	mov    %esp,%ebp
c0109739:	57                   	push   %edi
c010973a:	56                   	push   %esi
c010973b:	83 ec 20             	sub    $0x20,%esp
c010973e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109741:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109744:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109747:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c010974a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010974d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109750:	89 d1                	mov    %edx,%ecx
c0109752:	89 c2                	mov    %eax,%edx
c0109754:	89 ce                	mov    %ecx,%esi
c0109756:	89 d7                	mov    %edx,%edi
c0109758:	ac                   	lods   %ds:(%esi),%al
c0109759:	aa                   	stos   %al,%es:(%edi)
c010975a:	84 c0                	test   %al,%al
c010975c:	75 fa                	jne    c0109758 <strcpy+0x22>
c010975e:	89 fa                	mov    %edi,%edx
c0109760:	89 f1                	mov    %esi,%ecx
c0109762:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c0109765:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0109768:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c010976b:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c010976e:	83 c4 20             	add    $0x20,%esp
c0109771:	5e                   	pop    %esi
c0109772:	5f                   	pop    %edi
c0109773:	5d                   	pop    %ebp
c0109774:	c3                   	ret    

c0109775 <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c0109775:	55                   	push   %ebp
c0109776:	89 e5                	mov    %esp,%ebp
c0109778:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c010977b:	8b 45 08             	mov    0x8(%ebp),%eax
c010977e:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c0109781:	eb 21                	jmp    c01097a4 <strncpy+0x2f>
        if ((*p = *src) != '\0') {
c0109783:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109786:	0f b6 10             	movzbl (%eax),%edx
c0109789:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010978c:	88 10                	mov    %dl,(%eax)
c010978e:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109791:	0f b6 00             	movzbl (%eax),%eax
c0109794:	84 c0                	test   %al,%al
c0109796:	74 04                	je     c010979c <strncpy+0x27>
            src ++;
c0109798:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
        }
        p ++, len --;
c010979c:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c01097a0:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
    char *p = dst;
    while (len > 0) {
c01097a4:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01097a8:	75 d9                	jne    c0109783 <strncpy+0xe>
        if ((*p = *src) != '\0') {
            src ++;
        }
        p ++, len --;
    }
    return dst;
c01097aa:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01097ad:	c9                   	leave  
c01097ae:	c3                   	ret    

c01097af <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c01097af:	55                   	push   %ebp
c01097b0:	89 e5                	mov    %esp,%ebp
c01097b2:	57                   	push   %edi
c01097b3:	56                   	push   %esi
c01097b4:	83 ec 20             	sub    $0x20,%esp
c01097b7:	8b 45 08             	mov    0x8(%ebp),%eax
c01097ba:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01097bd:	8b 45 0c             	mov    0xc(%ebp),%eax
c01097c0:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRCMP
static inline int
__strcmp(const char *s1, const char *s2) {
    int d0, d1, ret;
    asm volatile (
c01097c3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01097c6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097c9:	89 d1                	mov    %edx,%ecx
c01097cb:	89 c2                	mov    %eax,%edx
c01097cd:	89 ce                	mov    %ecx,%esi
c01097cf:	89 d7                	mov    %edx,%edi
c01097d1:	ac                   	lods   %ds:(%esi),%al
c01097d2:	ae                   	scas   %es:(%edi),%al
c01097d3:	75 08                	jne    c01097dd <strcmp+0x2e>
c01097d5:	84 c0                	test   %al,%al
c01097d7:	75 f8                	jne    c01097d1 <strcmp+0x22>
c01097d9:	31 c0                	xor    %eax,%eax
c01097db:	eb 04                	jmp    c01097e1 <strcmp+0x32>
c01097dd:	19 c0                	sbb    %eax,%eax
c01097df:	0c 01                	or     $0x1,%al
c01097e1:	89 fa                	mov    %edi,%edx
c01097e3:	89 f1                	mov    %esi,%ecx
c01097e5:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01097e8:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c01097eb:	89 55 e4             	mov    %edx,-0x1c(%ebp)
        "orb $1, %%al;"
        "3:"
        : "=a" (ret), "=&S" (d0), "=&D" (d1)
        : "1" (s1), "2" (s2)
        : "memory");
    return ret;
c01097ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c01097f1:	83 c4 20             	add    $0x20,%esp
c01097f4:	5e                   	pop    %esi
c01097f5:	5f                   	pop    %edi
c01097f6:	5d                   	pop    %ebp
c01097f7:	c3                   	ret    

c01097f8 <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c01097f8:	55                   	push   %ebp
c01097f9:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c01097fb:	eb 0c                	jmp    c0109809 <strncmp+0x11>
        n --, s1 ++, s2 ++;
c01097fd:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
c0109801:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c0109805:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c0109809:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010980d:	74 1a                	je     c0109829 <strncmp+0x31>
c010980f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109812:	0f b6 00             	movzbl (%eax),%eax
c0109815:	84 c0                	test   %al,%al
c0109817:	74 10                	je     c0109829 <strncmp+0x31>
c0109819:	8b 45 08             	mov    0x8(%ebp),%eax
c010981c:	0f b6 10             	movzbl (%eax),%edx
c010981f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109822:	0f b6 00             	movzbl (%eax),%eax
c0109825:	38 c2                	cmp    %al,%dl
c0109827:	74 d4                	je     c01097fd <strncmp+0x5>
        n --, s1 ++, s2 ++;
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c0109829:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010982d:	74 18                	je     c0109847 <strncmp+0x4f>
c010982f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109832:	0f b6 00             	movzbl (%eax),%eax
c0109835:	0f b6 d0             	movzbl %al,%edx
c0109838:	8b 45 0c             	mov    0xc(%ebp),%eax
c010983b:	0f b6 00             	movzbl (%eax),%eax
c010983e:	0f b6 c0             	movzbl %al,%eax
c0109841:	29 c2                	sub    %eax,%edx
c0109843:	89 d0                	mov    %edx,%eax
c0109845:	eb 05                	jmp    c010984c <strncmp+0x54>
c0109847:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010984c:	5d                   	pop    %ebp
c010984d:	c3                   	ret    

c010984e <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c010984e:	55                   	push   %ebp
c010984f:	89 e5                	mov    %esp,%ebp
c0109851:	83 ec 04             	sub    $0x4,%esp
c0109854:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109857:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010985a:	eb 14                	jmp    c0109870 <strchr+0x22>
        if (*s == c) {
c010985c:	8b 45 08             	mov    0x8(%ebp),%eax
c010985f:	0f b6 00             	movzbl (%eax),%eax
c0109862:	3a 45 fc             	cmp    -0x4(%ebp),%al
c0109865:	75 05                	jne    c010986c <strchr+0x1e>
            return (char *)s;
c0109867:	8b 45 08             	mov    0x8(%ebp),%eax
c010986a:	eb 13                	jmp    c010987f <strchr+0x31>
        }
        s ++;
c010986c:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
    while (*s != '\0') {
c0109870:	8b 45 08             	mov    0x8(%ebp),%eax
c0109873:	0f b6 00             	movzbl (%eax),%eax
c0109876:	84 c0                	test   %al,%al
c0109878:	75 e2                	jne    c010985c <strchr+0xe>
        if (*s == c) {
            return (char *)s;
        }
        s ++;
    }
    return NULL;
c010987a:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010987f:	c9                   	leave  
c0109880:	c3                   	ret    

c0109881 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c0109881:	55                   	push   %ebp
c0109882:	89 e5                	mov    %esp,%ebp
c0109884:	83 ec 04             	sub    $0x4,%esp
c0109887:	8b 45 0c             	mov    0xc(%ebp),%eax
c010988a:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010988d:	eb 11                	jmp    c01098a0 <strfind+0x1f>
        if (*s == c) {
c010988f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109892:	0f b6 00             	movzbl (%eax),%eax
c0109895:	3a 45 fc             	cmp    -0x4(%ebp),%al
c0109898:	75 02                	jne    c010989c <strfind+0x1b>
            break;
c010989a:	eb 0e                	jmp    c01098aa <strfind+0x29>
        }
        s ++;
c010989c:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
    while (*s != '\0') {
c01098a0:	8b 45 08             	mov    0x8(%ebp),%eax
c01098a3:	0f b6 00             	movzbl (%eax),%eax
c01098a6:	84 c0                	test   %al,%al
c01098a8:	75 e5                	jne    c010988f <strfind+0xe>
        if (*s == c) {
            break;
        }
        s ++;
    }
    return (char *)s;
c01098aa:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01098ad:	c9                   	leave  
c01098ae:	c3                   	ret    

c01098af <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c01098af:	55                   	push   %ebp
c01098b0:	89 e5                	mov    %esp,%ebp
c01098b2:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c01098b5:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
c01098bc:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c01098c3:	eb 04                	jmp    c01098c9 <strtol+0x1a>
        s ++;
c01098c5:	83 45 08 01          	addl   $0x1,0x8(%ebp)
strtol(const char *s, char **endptr, int base) {
    int neg = 0;
    long val = 0;

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c01098c9:	8b 45 08             	mov    0x8(%ebp),%eax
c01098cc:	0f b6 00             	movzbl (%eax),%eax
c01098cf:	3c 20                	cmp    $0x20,%al
c01098d1:	74 f2                	je     c01098c5 <strtol+0x16>
c01098d3:	8b 45 08             	mov    0x8(%ebp),%eax
c01098d6:	0f b6 00             	movzbl (%eax),%eax
c01098d9:	3c 09                	cmp    $0x9,%al
c01098db:	74 e8                	je     c01098c5 <strtol+0x16>
        s ++;
    }

    // plus/minus sign
    if (*s == '+') {
c01098dd:	8b 45 08             	mov    0x8(%ebp),%eax
c01098e0:	0f b6 00             	movzbl (%eax),%eax
c01098e3:	3c 2b                	cmp    $0x2b,%al
c01098e5:	75 06                	jne    c01098ed <strtol+0x3e>
        s ++;
c01098e7:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c01098eb:	eb 15                	jmp    c0109902 <strtol+0x53>
    }
    else if (*s == '-') {
c01098ed:	8b 45 08             	mov    0x8(%ebp),%eax
c01098f0:	0f b6 00             	movzbl (%eax),%eax
c01098f3:	3c 2d                	cmp    $0x2d,%al
c01098f5:	75 0b                	jne    c0109902 <strtol+0x53>
        s ++, neg = 1;
c01098f7:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c01098fb:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c0109902:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109906:	74 06                	je     c010990e <strtol+0x5f>
c0109908:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c010990c:	75 24                	jne    c0109932 <strtol+0x83>
c010990e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109911:	0f b6 00             	movzbl (%eax),%eax
c0109914:	3c 30                	cmp    $0x30,%al
c0109916:	75 1a                	jne    c0109932 <strtol+0x83>
c0109918:	8b 45 08             	mov    0x8(%ebp),%eax
c010991b:	83 c0 01             	add    $0x1,%eax
c010991e:	0f b6 00             	movzbl (%eax),%eax
c0109921:	3c 78                	cmp    $0x78,%al
c0109923:	75 0d                	jne    c0109932 <strtol+0x83>
        s += 2, base = 16;
c0109925:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c0109929:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
c0109930:	eb 2a                	jmp    c010995c <strtol+0xad>
    }
    else if (base == 0 && s[0] == '0') {
c0109932:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109936:	75 17                	jne    c010994f <strtol+0xa0>
c0109938:	8b 45 08             	mov    0x8(%ebp),%eax
c010993b:	0f b6 00             	movzbl (%eax),%eax
c010993e:	3c 30                	cmp    $0x30,%al
c0109940:	75 0d                	jne    c010994f <strtol+0xa0>
        s ++, base = 8;
c0109942:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c0109946:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
c010994d:	eb 0d                	jmp    c010995c <strtol+0xad>
    }
    else if (base == 0) {
c010994f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109953:	75 07                	jne    c010995c <strtol+0xad>
        base = 10;
c0109955:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c010995c:	8b 45 08             	mov    0x8(%ebp),%eax
c010995f:	0f b6 00             	movzbl (%eax),%eax
c0109962:	3c 2f                	cmp    $0x2f,%al
c0109964:	7e 1b                	jle    c0109981 <strtol+0xd2>
c0109966:	8b 45 08             	mov    0x8(%ebp),%eax
c0109969:	0f b6 00             	movzbl (%eax),%eax
c010996c:	3c 39                	cmp    $0x39,%al
c010996e:	7f 11                	jg     c0109981 <strtol+0xd2>
            dig = *s - '0';
c0109970:	8b 45 08             	mov    0x8(%ebp),%eax
c0109973:	0f b6 00             	movzbl (%eax),%eax
c0109976:	0f be c0             	movsbl %al,%eax
c0109979:	83 e8 30             	sub    $0x30,%eax
c010997c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010997f:	eb 48                	jmp    c01099c9 <strtol+0x11a>
        }
        else if (*s >= 'a' && *s <= 'z') {
c0109981:	8b 45 08             	mov    0x8(%ebp),%eax
c0109984:	0f b6 00             	movzbl (%eax),%eax
c0109987:	3c 60                	cmp    $0x60,%al
c0109989:	7e 1b                	jle    c01099a6 <strtol+0xf7>
c010998b:	8b 45 08             	mov    0x8(%ebp),%eax
c010998e:	0f b6 00             	movzbl (%eax),%eax
c0109991:	3c 7a                	cmp    $0x7a,%al
c0109993:	7f 11                	jg     c01099a6 <strtol+0xf7>
            dig = *s - 'a' + 10;
c0109995:	8b 45 08             	mov    0x8(%ebp),%eax
c0109998:	0f b6 00             	movzbl (%eax),%eax
c010999b:	0f be c0             	movsbl %al,%eax
c010999e:	83 e8 57             	sub    $0x57,%eax
c01099a1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01099a4:	eb 23                	jmp    c01099c9 <strtol+0x11a>
        }
        else if (*s >= 'A' && *s <= 'Z') {
c01099a6:	8b 45 08             	mov    0x8(%ebp),%eax
c01099a9:	0f b6 00             	movzbl (%eax),%eax
c01099ac:	3c 40                	cmp    $0x40,%al
c01099ae:	7e 3d                	jle    c01099ed <strtol+0x13e>
c01099b0:	8b 45 08             	mov    0x8(%ebp),%eax
c01099b3:	0f b6 00             	movzbl (%eax),%eax
c01099b6:	3c 5a                	cmp    $0x5a,%al
c01099b8:	7f 33                	jg     c01099ed <strtol+0x13e>
            dig = *s - 'A' + 10;
c01099ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01099bd:	0f b6 00             	movzbl (%eax),%eax
c01099c0:	0f be c0             	movsbl %al,%eax
c01099c3:	83 e8 37             	sub    $0x37,%eax
c01099c6:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c01099c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01099cc:	3b 45 10             	cmp    0x10(%ebp),%eax
c01099cf:	7c 02                	jl     c01099d3 <strtol+0x124>
            break;
c01099d1:	eb 1a                	jmp    c01099ed <strtol+0x13e>
        }
        s ++, val = (val * base) + dig;
c01099d3:	83 45 08 01          	addl   $0x1,0x8(%ebp)
c01099d7:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01099da:	0f af 45 10          	imul   0x10(%ebp),%eax
c01099de:	89 c2                	mov    %eax,%edx
c01099e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01099e3:	01 d0                	add    %edx,%eax
c01099e5:	89 45 f8             	mov    %eax,-0x8(%ebp)
        // we don't properly detect overflow!
    }
c01099e8:	e9 6f ff ff ff       	jmp    c010995c <strtol+0xad>

    if (endptr) {
c01099ed:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01099f1:	74 08                	je     c01099fb <strtol+0x14c>
        *endptr = (char *) s;
c01099f3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01099f6:	8b 55 08             	mov    0x8(%ebp),%edx
c01099f9:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c01099fb:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01099ff:	74 07                	je     c0109a08 <strtol+0x159>
c0109a01:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109a04:	f7 d8                	neg    %eax
c0109a06:	eb 03                	jmp    c0109a0b <strtol+0x15c>
c0109a08:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c0109a0b:	c9                   	leave  
c0109a0c:	c3                   	ret    

c0109a0d <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c0109a0d:	55                   	push   %ebp
c0109a0e:	89 e5                	mov    %esp,%ebp
c0109a10:	57                   	push   %edi
c0109a11:	83 ec 24             	sub    $0x24,%esp
c0109a14:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109a17:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c0109a1a:	0f be 45 d8          	movsbl -0x28(%ebp),%eax
c0109a1e:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a21:	89 55 f8             	mov    %edx,-0x8(%ebp)
c0109a24:	88 45 f7             	mov    %al,-0x9(%ebp)
c0109a27:	8b 45 10             	mov    0x10(%ebp),%eax
c0109a2a:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c0109a2d:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0109a30:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
c0109a34:	8b 55 f8             	mov    -0x8(%ebp),%edx
c0109a37:	89 d7                	mov    %edx,%edi
c0109a39:	f3 aa                	rep stos %al,%es:(%edi)
c0109a3b:	89 fa                	mov    %edi,%edx
c0109a3d:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c0109a40:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c0109a43:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c0109a46:	83 c4 24             	add    $0x24,%esp
c0109a49:	5f                   	pop    %edi
c0109a4a:	5d                   	pop    %ebp
c0109a4b:	c3                   	ret    

c0109a4c <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c0109a4c:	55                   	push   %ebp
c0109a4d:	89 e5                	mov    %esp,%ebp
c0109a4f:	57                   	push   %edi
c0109a50:	56                   	push   %esi
c0109a51:	53                   	push   %ebx
c0109a52:	83 ec 30             	sub    $0x30,%esp
c0109a55:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a58:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109a5b:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109a5e:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109a61:	8b 45 10             	mov    0x10(%ebp),%eax
c0109a64:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c0109a67:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109a6a:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0109a6d:	73 42                	jae    c0109ab1 <memmove+0x65>
c0109a6f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109a72:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0109a75:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109a78:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109a7b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109a7e:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0109a81:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109a84:	c1 e8 02             	shr    $0x2,%eax
c0109a87:	89 c1                	mov    %eax,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c0109a89:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109a8c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109a8f:	89 d7                	mov    %edx,%edi
c0109a91:	89 c6                	mov    %eax,%esi
c0109a93:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c0109a95:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0109a98:	83 e1 03             	and    $0x3,%ecx
c0109a9b:	74 02                	je     c0109a9f <memmove+0x53>
c0109a9d:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0109a9f:	89 f0                	mov    %esi,%eax
c0109aa1:	89 fa                	mov    %edi,%edx
c0109aa3:	89 4d d8             	mov    %ecx,-0x28(%ebp)
c0109aa6:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0109aa9:	89 45 d0             	mov    %eax,-0x30(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c0109aac:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109aaf:	eb 36                	jmp    c0109ae7 <memmove+0x9b>
    asm volatile (
        "std;"
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c0109ab1:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109ab4:	8d 50 ff             	lea    -0x1(%eax),%edx
c0109ab7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109aba:	01 c2                	add    %eax,%edx
c0109abc:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109abf:	8d 48 ff             	lea    -0x1(%eax),%ecx
c0109ac2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109ac5:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
        return __memcpy(dst, src, n);
    }
    int d0, d1, d2;
    asm volatile (
c0109ac8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109acb:	89 c1                	mov    %eax,%ecx
c0109acd:	89 d8                	mov    %ebx,%eax
c0109acf:	89 d6                	mov    %edx,%esi
c0109ad1:	89 c7                	mov    %eax,%edi
c0109ad3:	fd                   	std    
c0109ad4:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0109ad6:	fc                   	cld    
c0109ad7:	89 f8                	mov    %edi,%eax
c0109ad9:	89 f2                	mov    %esi,%edx
c0109adb:	89 4d cc             	mov    %ecx,-0x34(%ebp)
c0109ade:	89 55 c8             	mov    %edx,-0x38(%ebp)
c0109ae1:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        "rep; movsb;"
        "cld;"
        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
        : "memory");
    return dst;
c0109ae4:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c0109ae7:	83 c4 30             	add    $0x30,%esp
c0109aea:	5b                   	pop    %ebx
c0109aeb:	5e                   	pop    %esi
c0109aec:	5f                   	pop    %edi
c0109aed:	5d                   	pop    %ebp
c0109aee:	c3                   	ret    

c0109aef <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c0109aef:	55                   	push   %ebp
c0109af0:	89 e5                	mov    %esp,%ebp
c0109af2:	57                   	push   %edi
c0109af3:	56                   	push   %esi
c0109af4:	83 ec 20             	sub    $0x20,%esp
c0109af7:	8b 45 08             	mov    0x8(%ebp),%eax
c0109afa:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109afd:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109b00:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109b03:	8b 45 10             	mov    0x10(%ebp),%eax
c0109b06:	89 45 ec             	mov    %eax,-0x14(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0109b09:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109b0c:	c1 e8 02             	shr    $0x2,%eax
c0109b0f:	89 c1                	mov    %eax,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
    int d0, d1, d2;
    asm volatile (
c0109b11:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109b14:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109b17:	89 d7                	mov    %edx,%edi
c0109b19:	89 c6                	mov    %eax,%esi
c0109b1b:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c0109b1d:	8b 4d ec             	mov    -0x14(%ebp),%ecx
c0109b20:	83 e1 03             	and    $0x3,%ecx
c0109b23:	74 02                	je     c0109b27 <memcpy+0x38>
c0109b25:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0109b27:	89 f0                	mov    %esi,%eax
c0109b29:	89 fa                	mov    %edi,%edx
c0109b2b:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c0109b2e:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0109b31:	89 45 e0             	mov    %eax,-0x20(%ebp)
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
        : "memory");
    return dst;
c0109b34:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c0109b37:	83 c4 20             	add    $0x20,%esp
c0109b3a:	5e                   	pop    %esi
c0109b3b:	5f                   	pop    %edi
c0109b3c:	5d                   	pop    %ebp
c0109b3d:	c3                   	ret    

c0109b3e <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c0109b3e:	55                   	push   %ebp
c0109b3f:	89 e5                	mov    %esp,%ebp
c0109b41:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c0109b44:	8b 45 08             	mov    0x8(%ebp),%eax
c0109b47:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
c0109b4a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109b4d:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
c0109b50:	eb 30                	jmp    c0109b82 <memcmp+0x44>
        if (*s1 != *s2) {
c0109b52:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109b55:	0f b6 10             	movzbl (%eax),%edx
c0109b58:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109b5b:	0f b6 00             	movzbl (%eax),%eax
c0109b5e:	38 c2                	cmp    %al,%dl
c0109b60:	74 18                	je     c0109b7a <memcmp+0x3c>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c0109b62:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109b65:	0f b6 00             	movzbl (%eax),%eax
c0109b68:	0f b6 d0             	movzbl %al,%edx
c0109b6b:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109b6e:	0f b6 00             	movzbl (%eax),%eax
c0109b71:	0f b6 c0             	movzbl %al,%eax
c0109b74:	29 c2                	sub    %eax,%edx
c0109b76:	89 d0                	mov    %edx,%eax
c0109b78:	eb 1a                	jmp    c0109b94 <memcmp+0x56>
        }
        s1 ++, s2 ++;
c0109b7a:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
c0109b7e:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
    const char *s1 = (const char *)v1;
    const char *s2 = (const char *)v2;
    while (n -- > 0) {
c0109b82:	8b 45 10             	mov    0x10(%ebp),%eax
c0109b85:	8d 50 ff             	lea    -0x1(%eax),%edx
c0109b88:	89 55 10             	mov    %edx,0x10(%ebp)
c0109b8b:	85 c0                	test   %eax,%eax
c0109b8d:	75 c3                	jne    c0109b52 <memcmp+0x14>
        if (*s1 != *s2) {
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
        }
        s1 ++, s2 ++;
    }
    return 0;
c0109b8f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0109b94:	c9                   	leave  
c0109b95:	c3                   	ret    
